Boost logo

Boost Users :

Subject: Re: [Boost-users] How to make is_arithmetic true for a UDT
From: John Maddock (boost.regex_at_[hidden])
Date: 2012-07-12 05:31:31


>I am facing the need to get my User Defined Type to return true from
>
> boost::is_arithmetic

You don't, a UDT is not an arithmetic type (according to the type system
which is what type_traits honors) it's a class type.

> (This is to meet a check for autoprefixing in Boost.Units)

Looks like there are two places this is used in Units - and both are
implementation details - for auto-prefixing looks like you need to overload
autoprefix_norm for your type. The other use is in
is_non_narrowing_conversion, which you would [partially-] specialize for
your type.

Hope that makes sense, John.


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