
On Wed, Sep 15, 2010 at 2:02 PM, Ruediger Berlich <ruediger.berlich@iwr.fzk.de> wrote:
Hi there,
I'd like to make sure that some of my classes are only used with particular value types. This is easy enough to implement for integers, using BOOST_CONCEPT_ASSERT((boost::Integer<T>)) . However, there is no boost::FloatingPoint<T>, which is a bit odd.
The following, easy code seems to do what I want, but reqires inclusion of boost/concept/detail/concept_def.hpp
/*****************************************************************/
namespace boost { BOOST_concept(FloatingPoint, (T))
From what I understand, this means that I am relying on implementation details with the above code.
Yes. Why did you use the undocumente BOOST_concept macro? That only exists for backward compatibility with older uses of the BCCL.
Is there any way to do the above in a portable way?
// untested #include <boost/type_traits/is_floating.hpp> #include <boost/mpl/assert.hpp> template <class T> struct FloatingPoint { BOOST_MPL_ASSERT((boost::is_floating<T>)); };
P.S.: If the above seems acceptable, please feel free to include it in Boost.Concept.
If what I suggested works out for you, would you mind submitting a patch to Trac? -- Dave Abrahams BoostPro Computing http://www.boostpro.com