|
Boost : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-01-14 22:51:36
I don't see a benefit of the inheritance hierarchy for boost purposes. You
say the benefit is that it reduces checking to a pointer conversion...
but this makes little difference because causing the compiler error is
easy. We could just as easily use boost static assert with is_associative.
template <class Domain, class Op>
class AssociativeConcept {
public:
void constraints() {
function_requires< BinaryOpConcept<Domain, Op> >();
BOOST_STATIC_ASSERT(is_associative<Domain, OP>::value);
}
};
It looks like the above gets the job done, and is extremely simple.
Are there other advantages to the inheritance hierarchy?
On Sun, 14 Jan 2001, Doug Gregor wrote:
gregod> In any case, for named conformance concept checking I
gregod> would suggest representing a concept lattice as an
gregod> inheritance hierarchy. Then, checking named conformance
gregod> (taking subconcepts into account) reduces to checking a
gregod> pointer conversion similarly to Boost's is_convertible.
gregod> Unfortunately, the
----------------------------------------------------------------------
Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
Ph.D. Candidate email: jsiek_at_[hidden]
Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk