Boost logo

Boost Users :

Subject: [Boost-users] boost::mpl and VS 2005
From: narinder.claire_at_[hidden]
Date: 2011-07-12 07:57:55


Hi,

The following piece of code compile successfully on VS2008,VS2010 & GCC
4.5.2 but fails to compile on VS2005.
Is the likely to be because of a bug in VS2005 ? (boost v 1.46.1)
------------------------------------------------------------
#include<iostream>
#include<string>

#include<boost/tr1/type_traits.hpp>
#include<boost/mpl/empty.hpp>
#include<boost/mpl/vector.hpp>
#include<boost/mpl/filter_view.hpp>
#include<boost/utility.hpp>

template<class T>
struct is_recognised_type
{
    static const bool value =false;
};

typedef boost::mpl::vector<std::string> naked_variant_type_list;

struct myclass
{
    myclass(){}

    template<class T>
    myclass(const T&t,
            const typename
boost::disable_if_c<is_recognised_type<T>::value,T >::type * ptr =0,
            const typename boost::disable_if_c<
                    boost::mpl::empty<
                       typename boost::mpl::filter_view<
 naked_variant_type_list,boost::is_convertible<T,boost::mpl::_>
>::type>::value>::type * pt =0,
            const typename boost::enable_if_c<
                    boost::mpl::empty<
                       typename boost::mpl::filter_view<
 naked_variant_type_list,std::tr1::is_base_of<boost::mpl::_,T>
>::type>::value>::type * pt2 =0)
    {
    }

};

int main()
{
    myclass m;
    m = "hello";
}

------------------------------------------------------------

My workaround is to collapse is_convertible and is_base_of into a
single type_trait is_convertible_but_not_derived_from. and then it works.
The problems seems to be that there are two trait checks, using either one
individualy
seems to work.

Rgds
Narinder

___________________________________________________________
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is prohibited.

Please refer to http://www.bnpparibas.co.uk/en/information/legal_information.asp?Code=ECAS-845C5H for additional disclosures.


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