Boost logo

Boost Users :

Subject: Re: [Boost-users] boost concept creation
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-01-16 13:18:04


AMDG

Zach wrote:
> Can someone give me a high level explanation of the idea behind how concepts
> work? I'm trying to write a new concept class which enforces that two types
> are the same and it's not quite clicking. Strangely gcc has this concept
> built in, so I was surprised that boost didn't. I noticed a boost::is_same<>
> template, but it's not a concept, so it's not usable inside a
> BOOST_CONCEPT_ASSERT() macro.
>

For is_same and other boolean metafunctions you can use
an assertion, which will give a better error message anyway:

    BOOST_MPL_ASSERT((boost::is_same<T1, T2>));

In Christ,
Steven Watanabe


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