epoc32/include/stdapis/boost/utility/base_from_member.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/utility/base_from_member.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,87 @@
     1.4 +//  boost utility/base_from_member.hpp header file  --------------------------//
     1.5 +
     1.6 +//  Copyright 2001, 2003, 2004 Daryle Walker.  Use, modification, and
     1.7 +//  distribution are subject to the Boost Software License, Version 1.0.  (See
     1.8 +//  accompanying file LICENSE_1_0.txt or a copy at
     1.9 +//  <http://www.boost.org/LICENSE_1_0.txt>.)
    1.10 +
    1.11 +//  See <http://www.boost.org/libs/utility/> for the library's home page.
    1.12 +
    1.13 +#ifndef BOOST_UTILITY_BASE_FROM_MEMBER_HPP
    1.14 +#define BOOST_UTILITY_BASE_FROM_MEMBER_HPP
    1.15 +
    1.16 +#include <boost/preprocessor/arithmetic/inc.hpp>
    1.17 +#include <boost/preprocessor/repetition/enum_binary_params.hpp>
    1.18 +#include <boost/preprocessor/repetition/enum_params.hpp>
    1.19 +#include <boost/preprocessor/repetition/repeat_from_to.hpp>
    1.20 +
    1.21 +
    1.22 +//  Base-from-member arity configuration macro  ------------------------------//
    1.23 +
    1.24 +// The following macro determines how many arguments will be in the largest
    1.25 +// constructor template of base_from_member.  Constructor templates will be
    1.26 +// generated from one argument to this maximum.  Code from other files can read
    1.27 +// this number if they need to always match the exact maximum base_from_member
    1.28 +// uses.  The maximum constructor length can be changed by overriding the
    1.29 +// #defined constant.  Make sure to apply the override, if any, for all source
    1.30 +// files during project compiling for consistency.
    1.31 +
    1.32 +// Contributed by Jonathan Turkanis
    1.33 +
    1.34 +#ifndef BOOST_BASE_FROM_MEMBER_MAX_ARITY
    1.35 +#define BOOST_BASE_FROM_MEMBER_MAX_ARITY  10
    1.36 +#endif
    1.37 +
    1.38 +
    1.39 +//  An iteration of a constructor template for base_from_member  -------------//
    1.40 +
    1.41 +// A macro that should expand to:
    1.42 +//     template < typename T1, ..., typename Tn >
    1.43 +//     base_from_member( T1 x1, ..., Tn xn )
    1.44 +//         : member( x1, ..., xn )
    1.45 +//         {}
    1.46 +// This macro should only persist within this file.
    1.47 +
    1.48 +#define BOOST_PRIVATE_CTR_DEF( z, n, data )                            \
    1.49 +    template < BOOST_PP_ENUM_PARAMS(n, typename T) >                   \
    1.50 +    explicit base_from_member( BOOST_PP_ENUM_BINARY_PARAMS(n, T, x) )  \
    1.51 +        : member( BOOST_PP_ENUM_PARAMS(n, x) )                         \
    1.52 +        {}                                                             \
    1.53 +    /**/
    1.54 +
    1.55 +
    1.56 +namespace boost
    1.57 +{
    1.58 +
    1.59 +//  Base-from-member class template  -----------------------------------------//
    1.60 +
    1.61 +// Helper to initialize a base object so a derived class can use this
    1.62 +// object in the initialization of another base class.  Used by
    1.63 +// Dietmar Kuehl from ideas by Ron Klatcho to solve the problem of a
    1.64 +// base class needing to be initialized by a member.
    1.65 +
    1.66 +// Contributed by Daryle Walker
    1.67 +
    1.68 +template < typename MemberType, int UniqueID = 0 >
    1.69 +class base_from_member
    1.70 +{
    1.71 +protected:
    1.72 +    MemberType  member;
    1.73 +
    1.74 +    base_from_member()
    1.75 +        : member()
    1.76 +        {}
    1.77 +
    1.78 +    BOOST_PP_REPEAT_FROM_TO( 1, BOOST_PP_INC(BOOST_BASE_FROM_MEMBER_MAX_ARITY),
    1.79 +     BOOST_PRIVATE_CTR_DEF, _ )
    1.80 +
    1.81 +};  // boost::base_from_member
    1.82 +
    1.83 +}  // namespace boost
    1.84 +
    1.85 +
    1.86 +// Undo any private macros
    1.87 +#undef BOOST_PRIVATE_CTR_DEF
    1.88 +
    1.89 +
    1.90 +#endif  // BOOST_UTILITY_BASE_FROM_MEMBER_HPP