Boost logo

Boost Users :

Subject: Re: [Boost-users] is_foo_type naming rule
From: Antony Polukhin (antoshkka_at_[hidden])
Date: 2013-03-09 02:34:45


2013/3/8 Niitsuma Hirotaka <hirotaka.niitsuma_at_[hidden]>:
> There are two type is_foo_type functor
> For example
> is_double
> can be
>
> ---------
> template<typename T>
> struct is_double_template : boost::is_same<T,double>
> {};
> ---------
>
> or
>
> ---------
> struct is_double_runtime
> {
> template<typename T>
> bool operator()(T x){return false;}
> bool operator()(double x){return true;}
> };

Why don't you just use BOOST_TYPEOF(x) macro?

  T d;
  std::cout << is_double<T>::value << std::endl;
  std::cout << is_double<BOOST_TYPEOF(d)>::value << std::endl;

--
Best regards,
Antony Polukhin

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