
Is there any trait in Boost that allows me to get the value of one for any numeric type? What I'm looking for is something that would work like the following: boost::numeric_traits<int>::one; // 1 boost::numeric_traits<long>::one; // 1L boost::numeric_traits<double>::one; // 1.0 boost::numeric_traits<float>::one; // 1.0f And so on. Does it exist, or something equivalent? I've looked into NumericConversion, but I haven't quite found something similar. What I'm using now is something equivalent to the following: template<class Number> Number one() { return Number(1); } Maybe this is safe enough? I know I can do this trait by myself, but I would like to avoid it if possible, specially considering that I'm working on an already complex Boost library. Thanks. -- Javier Dehesa