extent,region: instantiation for 3d types

This commit is contained in:
Danny Robson 2015-03-06 17:52:40 +11:00
parent e69d970e22
commit 832472c861
2 changed files with 25 additions and 37 deletions

View File

@ -136,17 +136,18 @@ util::operator<< (std::ostream &os, util::extent<S,T> e)
} }
template std::ostream& util::operator<< (std::ostream&, util::extent<2,uint16_t>);
template std::ostream& util::operator<< (std::ostream&, util::extent<2,uint32_t>);
template std::ostream& util::operator<< (std::ostream&, util::extent<2,uint64_t>);
template std::ostream& util::operator<< (std::ostream&, util::extent<2,float>);
template std::ostream& util::operator<< (std::ostream&, util::extent<2,double>);
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
namespace util { namespace util {
template struct extent<2,uint32_t>; #define INSTANTIATE_S_T(S,T) \
template struct extent<2,uint64_t>; template struct extent<S,T>; \
template struct extent<2,float>; template std::ostream& operator<< (std::ostream&, extent<S,T>);
template struct extent<2,double>;
#define INSTANTIATE(T) \
INSTANTIATE_S_T(2,T) \
INSTANTIATE_S_T(3,T)
INSTANTIATE(uint32_t)
INSTANTIATE(uint64_t)
INSTANTIATE(float)
INSTANTIATE(double)
} }

View File

@ -352,22 +352,8 @@ void
util::region<S,T>::sanity (void) const { util::region<S,T>::sanity (void) const {
CHECK_GE (e.area (), 0); CHECK_GE (e.area (), 0);
static_assert(!std::is_floating_point<T>::value, if (std::is_floating_point<T>::value) {
"Floating point types need width and height checks"); CHECK_GE (min (e), 0);
}
//-----------------------------------------------------------------------------
namespace util {
template <>
void region<2,double>::sanity (void) const {
CHECK_GE (e.area (), 0);
}
template <>
void region<2,float>::sanity (void) const {
CHECK_GE (e.area (), 0);
} }
} }
@ -404,15 +390,16 @@ util::operator<< (std::ostream &os, const util::region<S,T> &rhs) {
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
namespace util { namespace util {
template struct region<2,uint32_t>; #define INSTANTIATE_S_T(S,T) \
template struct region<2,uint64_t>; template struct region<S,T>; \
template struct region<2,float>; template std::ostream& operator<< (std::ostream&, const region<S,T>&);
template struct region<2,double>;
template std::ostream& operator<< (std::ostream&, const region<2, int32_t>&); #define INSTANTIATE(T) \
template std::ostream& operator<< (std::ostream&, const region<2, int64_t>&); INSTANTIATE_S_T(2,T) \
template std::ostream& operator<< (std::ostream&, const region<2,uint32_t>&); INSTANTIATE_S_T(3,T)
template std::ostream& operator<< (std::ostream&, const region<2,uint64_t>&);
template std::ostream& operator<< (std::ostream&, const region<2, float>&); INSTANTIATE(uint32_t)
template std::ostream& operator<< (std::ostream&, const region<2, double>&); INSTANTIATE(uint64_t)
INSTANTIATE(float)
INSTANTIATE(double)
} }