Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2001-04-30 22:10:33


In lines 48 through 56 of <boost/random/lagged_fibonacci.hpp>, there's:

#define BOOST_RANDOM_FIBONACCI_VAL(T,P,Q,V,E) \
template<> \
struct fibonacci_validation<T, P, Q> \
{ \
  enum { is_specialized = true }; \
  static T value() { return V; } \
  static T tolerance() \
    { return std::max(E, 5*std::numeric_limits<T>::epsilon()); } \
};

I'm wondering if the "is_specialized" could be expressed like it is in the
main version (lines 40-46):

template<class T, unsigned int p, unsigned int q>
struct fibonacci_validation
{
  BOOST_STATIC_CONSTANT(bool, is_specialized = false);
  static T value() { return 0; }
  static T tolerance() { return 0; }
};

Just use "BOOST_STATIC_CONSTANT" in the macro. In some code I was working
on, I noticed that the "is_specialized" was glowing and always using an
enum-based constant was the cause. It's not major.

-- 
Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk