Boost logo

Boost :

From: John C. Femiani (john.femiani_at_[hidden])
Date: 2008-07-22 13:57:54

John C. Femiani wrote:
> Bruno Lalande wrote:
>> Hi John,
>> Thanks to have taken the time to test my code. You had the same result
>> as Barend, who was able to reproduce the problem with GCC cygwin
>> (3.4.4) but not MSVC. But the strange thing is that for me, the
>> problem occurs for any compiler (MSVC or GCC). I really don't
>> understand. Here is the list of compilers tested:
>> - Barend: MSVC 8 Express (succeeds), cygwin GCC 3.4.4 (fails)
>> - Me: MSVC 8 (fails), MSVC 9 Express (fails), GCC 4.2.3 (fails)
>> I don't think there can be any functional difference between the
>> express and normal version of the same MSVC so I don't understand.
>> Could you precise the exact version you used?
>> I've attached my MSVC compilation results to the mail.
>> Bruno
> I think boost is using the fact that the compiler should fail to
> define a nested enum when a concept assert fails, but that SFINAE
> should not consider that an error. It looks like it is doing this so
> that it can chain together many concept checks.
> I think this must be a bug, so I added a ticket
OK, so apparently the ticket was invalid because BOOST_CONCEPT_REQUIRES
does not actually use SFINAE, for technical reasons, so if we want
concept based overloading it just wont work.

I think that in order to approximate that you will need to create a

    template<class T> struct is_dummy: ::boost::mpl::false_ {};

    template<template<class T> >
    struct is_dummy<foo<T> > : ::boost::mpl::true_ {
        BOOST_CONCEPT_ASSERT( (DummyConcept<T> ));

    template<typename T> typename ::boost::enable_if<is_dummy<T>,
    func(T) {
          std::cout << "first overload" << std::endl;

and make that part of the concept, so you can use it with enable_if.


Boost list run by bdawes at, gregod at, cpdaniel at, john at