]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /* Copyright 2006-2009 Joaquin M Lopez Munoz. |
2 | * Distributed under the Boost Software License, Version 1.0. | |
3 | * (See accompanying file LICENSE_1_0.txt or copy at | |
4 | * http://www.boost.org/LICENSE_1_0.txt) | |
5 | * | |
6 | * See http://www.boost.org/libs/flyweight for library home page. | |
7 | */ | |
8 | ||
9 | #ifndef BOOST_FLYWEIGHT_DETAIL_NESTED_XXX_IF_NOT_PH_HPP | |
10 | #define BOOST_FLYWEIGHT_DETAIL_NESTED_XXX_IF_NOT_PH_HPP | |
11 | ||
12 | #if defined(_MSC_VER) | |
13 | #pragma once | |
14 | #endif | |
15 | ||
16 | #include <boost/flyweight/detail/is_placeholder_expr.hpp> | |
17 | #include <boost/mpl/if.hpp> | |
18 | ||
19 | /* nested_##name##_if_not_placeholder_expression<T>::type is T::name unless | |
20 | * T is an MPL placeholder expression, in which case it defaults to int. | |
21 | */ | |
22 | ||
23 | #define BOOST_FLYWEIGHT_NESTED_XXX_IF_NOT_PLACEHOLDER_EXPRESSION_DEF(name) \ | |
24 | struct nested_##name##_if_not_placeholder_expression_helper \ | |
25 | { \ | |
26 | typedef int name; \ | |
27 | }; \ | |
28 | \ | |
29 | template<typename T> \ | |
30 | struct nested_##name##_if_not_placeholder_expression \ | |
31 | { \ | |
32 | typedef typename boost::mpl::if_< \ | |
33 | boost::flyweights::detail::is_placeholder_expression<T>, \ | |
34 | nested_##name##_if_not_placeholder_expression_helper, \ | |
35 | T \ | |
36 | >::type::name type; \ | |
37 | }; | |
38 | ||
39 | #endif |