-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of John Maddock Sent: Thursday, July 12, 2012 10:32 AM To: boost-users@lists.boost.org Subject: Re: [Boost-users] How to make is_arithmetic true for a UDT
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.
Well I finally managed to string enough neurons together to write
// Specialization of autoprefix_norm for boost::units::measurement<Y>
// See io.hpp
// This is required to get autoprefix to work with this class.
template<class Y>
typename autoprefix_norm_impl