1 /* Copyright 2006-2008 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_DEFAULT_VALUE_POLICY_HPP 10 #define BOOST_FLYWEIGHT_DETAIL_DEFAULT_VALUE_POLICY_HPP 11 12 #if defined(_MSC_VER)&&(_MSC_VER>=1200) 13 #pragma once 14 #endif 15 16 #include <boost/flyweight/detail/value_tag.hpp> 17 #include <boost/preprocessor/repetition/enum_params.hpp> 18 19 /* Default value policy: the key is the same as the value. 20 */ 21 22 namespace boost{ 23 24 namespace flyweights{ 25 26 namespace detail{ 27 28 template<typename Value> 29 struct default_value_policy:value_marker 30 { 31 typedef Value key_type; 32 typedef Value value_type; 33 34 struct rep_type 35 { 36 /* template ctors */ 37 38 #define BOOST_FLYWEIGHT_PERFECT_FWD_NAME explicit rep_type 39 #define BOOST_FLYWEIGHT_PERFECT_FWD_BODY(n) \ 40 :x(BOOST_PP_ENUM_PARAMS(n,t)){} 41 #include <boost/flyweight/detail/perfect_fwd.hpp> 42 operator const value_type&boost::flyweights::detail::default_value_policy::rep_type43 operator const value_type&()const{return x;} 44 45 value_type x; 46 }; 47 construct_valueboost::flyweights::detail::default_value_policy48 static void construct_value(const rep_type&){} copy_valueboost::flyweights::detail::default_value_policy49 static void copy_value(const rep_type&){} 50 }; 51 52 } /* namespace flyweights::detail */ 53 54 } /* namespace flyweights */ 55 56 } /* namespace boost */ 57 58 #endif 59