
On 10/15/07, John Maddock <john@johnmaddock.co.uk> wrote:
Chad Walters wrote:
It's not entirely clear from your description if you really need to have is_arithmetic be true for your fixed_point class or if you just want to have some predicate that is true for both the built-in arithmetic types and your fixed_point class.
If the former, then you will likely run afoul of problems, for the reasons previously pointed out.
Hopefully it is the latter - in which case you should just define your own predicate with the appropriate logic (true for fixed_point or is_arithmetic types).
Right, or mpl::bool_<std::numeric_limits<T>::is_specialized> if you go down the "specialise numeric_limits" route.
Let me rephrase what you meaning to make sure that I understand you. You mean mpl::bool_<std::numeric_limits<T>::is_specialized> is the same as boost::is_arithmetic<T>::type for all basic none pointer type (int, double, unsigned...). It would cause less problems to specializing std::numeric_limits rather that specializing the user defined type like fixed point, right? Therefore, in this case, mpl::bool_<std::numeric_limits<T>::is_specialized> shall be used to test whether T is an number type, right? Thanks, Peng