PointConvert.h

Go to the documentation of this file.
00001 #ifndef PointConvert_HEADER
00002 #define PointConvert_HEADER
00003 
00004 #include "Point.h"
00005 
00006 namespace Geometry {
00007 
00008 template <bool, unsigned a, unsigned b> struct PointConverter;
00009 
00010 template <unsigned a, unsigned b> 
00011 struct PointConverter<true,a,b> {
00012   static const Point<a>& convert(const Point<b>& p) { return p; }
00013 };
00014 
00015 template <unsigned a, unsigned b> 
00016 struct PointConverter<false,a,b> {
00017   static const Point<a> dummy;
00018   static const Point<a>& convert(const Point<b>&) { assert(0); return dummy; }
00019 };
00020 
00021 // Use this one.
00022 template <unsigned a, unsigned b> const Point<a>& pointCast(const Point<b>& p) {
00023   return PointConverter<a==b, a, b>::convert(p);
00024 }
00025 
00026 }
00027 
00028 
00029 #endif

Generated on Thu Mar 27 19:04:14 2008 by  doxygen 1.4.6