|
Boost : |
From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2008-05-07 16:48:46
On Wed, May 7, 2008 at 2:15 PM, Terje Slettebø <tslettebo_at_[hidden]> wrote:
> >From: "Anthony Williams" <anthony_w.geo_at_[hidden]>
>
> > Does the boost concept checking library support overloading on concepts,
> so
> > you can have one implementation of an algorithm for random access
> iterators,
> > and another for bidirectional iterators, for example?
>
> As someone was pointed out in another posting, you can't use BCCL for this,
> since the checks fail with a compile error if a concept doesn't match.
> However, if you're able to define compile-time traits performing the concept
> check, then you _can_ overload on concepts, using enable_if. See the Concept
> Traits Library
> (http://web.archive.org/web/20050428001254/http://neoscientists.org/~tschwin
> ger/boostdev/concept_traits/libs/concept_traits/doc/) for an approach to
> this.
>
> This library is no longer maintained (at least by me, and unfortunately I
> don't have the source available right now, but Tobias Schwinger may have it
> around somewhere), not at least due to the upcoming C++0x, where this is
> supported in the language.
>
> The above library was mostly an experiment about how to get support for
> concepts in a library solution, but you really need language support to get
> the full effect of concepts.
That looks extremely interesting. I needed this a few months ago, and
was disappointed when I discovered that you couldn't do this with
BCCL.
I would love if this was made available somehow.
--Michael Fawcett
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk