$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Jonathan Turkanis (technews_at_[hidden])
Date: 2003-12-14 17:41:59
I have occassionally used mpl::bool_ as a tool for compile-time dispatch
based on a boolean condition. E.g.:
template<typename T>
void f(const T&, mpl::true_) { /* T is integral */ }
template<typename T>
void f(const T&, boost::mpl::false_) { /* T is non-integral */ }
template<typename T>
void f(const T& t) { f(t, mpl::bool_<is_integral<T>::value>()); }
Aside from the question of whether this is good programming style (e.g., it
is not self-documenting), I wonder if it is correct. Are the typedefs
typedef bool_<true> true_;
typedef bool_<false> false_;
part of the public interface of MPL, or are true_ and false_ only guaranteed
to be integral constant types with values true and false?
Jonathan