|
Boost Users : |
From: Robert Dailey (rcdailey_at_[hidden])
Date: 2008-03-25 10:22:01
On Tue, Mar 25, 2008 at 4:38 AM, Roman Perepelitsa <
roman.perepelitsa_at_[hidden]> wrote:
> Ovanes Markarian <om_boost <at> keywallet.com> writes:
> >
> >
> > Type Lib would help if you would like to distinguish only one type or
> some
> special type characteristic. There are some nice traits like: is_same, or
> is_base_of, or is_fundamental, or is_scalar, or is_integral etc.
> > Good Luck,Ovanes
> >
> > On 3/24/08, Robert Dailey <rcdailey <at> gmail.com> wrote:
> > Thanks, mpl::set is even better, I was going to use mpl::vector, which
> probably wouldn't have worked.I had a feeling the MPL library would be
> involved,
> but I wanted to make sure the type_traits library didn't already have
> something
> in place for this kind of situation. Thanks again!
> > On Mon, Mar 24, 2008 at 3:32 PM, Ovanes Markarian <om_boost <at>
> keywallet.com> wrote:
>
> If you only have 2 'valid' types then it's easier to use mpl::or_ instead
> of
> mpl::set.
>
> #include <boost/utility/enable_if.hpp>
> #include <boost/type_traits/is_same.hpp>
> #include <boost/mpl/or.hpp>
>
> using namespace boost;
> using namespace boost::mpl;
>
> template<class T>
> void foo
> (
> T,
> typename enable_if
> <
> or_<is_same<T, char>, is_same<T, wchar_t> >
> >::type * = 0
> )
> {
> }
>
> HTH,
> Roman Perepelitsa.
Another great idea :)
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