Boost logo

Boost Users :

From: sr kumar (srgama_at_[hidden])
Date: 2005-08-06 11:04:10


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 <boost/static_assert.hpp>
#include <boost/concept_check.hpp>
#include <boost/type_traits.hpp>

using namespace boost;

template <typename T>
struct MyConcept {
    void constraints() {
        (bool)(boost::is_base_and_derived<int,T>::value == true);
// (bool)(a<b);
    }
// T a,b;
};

class X {
public:
    X() {
        function_requires<MyConcept<X> > ();
        BOOST_STATIC_ASSERT(
          (is_base_and_derived<int,X>::value == true));
    }
    ~X(){}
// bool operator<(X& rhs) { return (x < rhs.x); }
    int x;
};

int main() { return 0;}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net