|
Boost : |
From: Doug Gregor (gregod_at_[hidden])
Date: 2001-01-14 22:30:22
On Sunday 14 January 2001 08:59, you wrote:
> That's a good question. I think the named conformance checking could work
> well for the semantic information, and could easy be added to the
> structural concept checks. However, I'd like to see something much simpler
> than what is in the Algebra library... something along the lines of
>
> is_associative<Domain, Op>::type (true_type or false_type)
>
> ::value (true or false)
>
> Then use this in a static assert in the appropriate concept checking
> classes.
Adding a simpler interface to Algebra is easy enough, but I do agree that its
concept specification is complex. Oddly enough, the design is/was intended to
make life easier for the user :).
In any case, for named conformance concept checking I would suggest
representing a concept lattice as an inheritance hierarchy. Then, checking
named conformance (taking subconcepts into account) reduces to checking a
pointer conversion similarly to Boost's is_convertible. Unfortunately, the
most complicated portion of the design is in handling relationships that
aren't strictly refinement, or for which multiple refinement possibilities
exist (e.g., the Abelian group/Abelian monoid relationship). Tecton lemmas
handle this well, but introduce a lot of ugliness into the hierarchy.
> It would be nice if we could have a fairly portable system, works
> with VC++, Borland, etc. That means no partial spec. :(
As long as the is_convertible variants can be made to work, I think the
system could be made portable for the simple checks (e.g., is_associative).
Unfortunately, extracting informance from the hierarchy has proven
complicated so far because it requires traversing the hierarchy using a lot
of partial specialization... the kind that can't be simulated with member
templates :(.
Doug
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk