On Tue, Mar 25, 2008 at 4:38 AM, Roman Perepelitsa <roman.perepelitsa@gmail.com> 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:> On Mon, Mar 24, 2008 at 3:32 PM, Ovanes Markarian <om_boost <at>
> 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!
keywallet.com> wrote:
If you only have 2 'valid' types then it's easier to use mpl::or_ instead of
mpl::set.
#include <boost/type_traits/is_same.hpp>
#include <boost/utility/enable_if.hpp>
#include <boost/mpl/or.hpp>
using namespace boost;
using namespace boost::mpl;
T,
template<class T>
void foo
(
typename enable_if
<
or_<is_same<T, char>, is_same<T, wchar_t> >
>::type * = 0
)
{
}
HTH,
Roman Perepelitsa.