Hi,
I am having trouble understanding why the following concept_check,
which checks an inheritance relationship, doesn't work but the
BOOST_STATIC_ASSERT does.
Just to make sure that the concept does actually work, the
LessThanComparableConcept was implemented and then commented out.
Would appreciate getting the missing link in my understanding.
thanks in advance for all help,
-sr
------------------------------------------
#include
sr kumar
Hi, I am having trouble understanding why the following concept_check, which checks an inheritance relationship, doesn't work but the BOOST_STATIC_ASSERT does.
Just to make sure that the concept does actually work, the LessThanComparableConcept was implemented and then commented out.
Would appreciate getting the missing link in my understanding.
thanks in advance for all help, -sr
------------------------------------------
#include
#include #include using namespace boost;
template <typename T> struct MyConcept { void constraints() { (bool)(boost::is_base_and_derived
::value == true);
According to the library docs, the constraints() function is supposed
to "exercise the valid expressions of the concept." The idea is that
if any of the expressions is invalid, instantiating the constraints()
will cause a compilation error. All you've done above is test that
is_base_and_derived
// (bool)(a
class X { public: X() { function_requires
(); BOOST_STATIC_ASSERT( (is_base_and_derived ::value == true)); } ~X(){} // bool operator<(X& rhs) { return (x < rhs.x); } int x; }; int main() { return 0;}
HTH, -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
David Abrahams
-
sr kumar