Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-09-19 14:09:16

From: "Howard Hinnant" <hinnant_at_[hidden]>

> On Thursday, September 19, 2002, at 02:11 PM, Iain K.Hanson wrote:
> > The only interesting dependacies imho are which libraries are used i.e.
> >
> > config
> > mpl
> > preprocessor
> > static_assert
> Agreed. These two:
> mpl
> preprocessor
> are throwing up a red flag with me. The type traits library was
> intended to be "fundamental" in the sense that it provided a base upon
> which other libs could be built without dragging in a lot of other
> stuff. I've never before envisioned it as "middle-ware".
> Do either of mpl or preprocessor depend on type traits? What is the
> motivation for the dependence of type traits on mpl and preprocessor?

The dependence on MPL is there so that the type_traits templates can be
used in mpl lambda expressions on less-conformant compilers. The dependency
is just on some macros which create nested rebind templates and
specializations as needed. If it weren't for this, Aleksey probably would
never have refactored type_traits.

By the way, this results in a HUGE interoperability win for MPL and

The dependence on the preprocessor library is an illusion, sort of.
Take a look at boost/type_traits/detail/is_function_ptr_helper.hpp:

======== schnip ==========
# include "boost/preprocessor/iterate.hpp"
# include "boost/preprocessor/enum_params.hpp"
# include "boost/preprocessor/comma_if.hpp"

namespace boost {
namespace type_traits {

template <class R>
struct is_function_ptr_helper
    BOOST_STATIC_CONSTANT(bool, value = false);

// preprocessor-generated part, don't edit by hand!

=========== schnipp schnipp ==========
<lots of function overloads here>
=========== schnapp schnapp ==========

    (0, 25, "boost/type_traits/detail/is_function_ptr_helper.hpp")


} // namespace type_traits
} // namespace boost


///// iteration


template <class R BOOST_PP_COMMA_IF(i) BOOST_PP_ENUM_PARAMS(i,class T)>
struct is_function_ptr_helper<R (*)(BOOST_PP_ENUM_PARAMS(i,T))> {
BOOST_STATIC_CONSTANT(bool, value = true); };

#undef i
========= schnapp ========

BOOST_TT_PREPROCCESSING_MODE is usually not defined. The header contains
the preprocessor code needed to re-generate the
schnipp-schnipp/schnapp-schnapp section

           David Abrahams * Boost Consulting
dave_at_[hidden] *

Boost list run by bdawes at, gregod at, cpdaniel at, john at