Boost logo

Boost Users :

From: Surya Kiran Gullapalli (skg_at_[hidden])
Date: 2005-10-27 22:03:25


>Imperative way:
>
> #include <boost/mpl/or.hpp>
> #include <boost/mpl/assert.hpp>
> #include <boost/type_traits/is_same.hpp>
>
> template <class T>
> struct myClass
> {
> BOOST_MPL_ASSERT((boost::mpl::or_<
> boost::is_same<T,int>
> , boost::is_same<T,float>
> , boost::is_same<T,char>
> >));
>
> ... // your class implementation here.
> };
>
>
>
>>to summarize my question,
>>is there any way i can restrict the compiler to accept only few type
>>names for my templated class (i.e., using standard c++ or boost)
>>
>>
>
>HTH,
>

Ah.. Thank you, I was just thinking in the same lines. May be i should
go over mpl more thoroughly.

Surya



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