Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:53

0001 /* Copyright 2006-2009 Joaquin M Lopez Munoz.
0002  * Distributed under the Boost Software License, Version 1.0.
0003  * (See accompanying file LICENSE_1_0.txt or copy at
0004  * http://www.boost.org/LICENSE_1_0.txt)
0005  *
0006  * See http://www.boost.org/libs/flyweight for library home page.
0007  */
0008 
0009 #ifndef BOOST_FLYWEIGHT_SET_FACTORY_HPP
0010 #define BOOST_FLYWEIGHT_SET_FACTORY_HPP
0011 
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015 
0016 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
0017 #include <boost/detail/allocator_utilities.hpp>
0018 #include <boost/flyweight/assoc_container_factory.hpp>
0019 #include <boost/flyweight/factory_tag.hpp>
0020 #include <boost/flyweight/set_factory_fwd.hpp>
0021 #include <boost/mpl/aux_/lambda_support.hpp>
0022 #include <boost/mpl/if.hpp>
0023 #include <set>
0024 
0025 /* Particularization of assoc_container_factory_class using a set.
0026  */
0027 
0028 namespace boost{
0029 
0030 namespace flyweights{
0031 
0032 template<
0033   typename Entry,typename Key,
0034   typename Compare,typename Allocator
0035 >
0036 class set_factory_class:
0037   public assoc_container_factory_class<
0038     std::set<
0039       Entry,
0040       typename boost::mpl::if_<
0041         mpl::is_na<Compare>,
0042         std::less<Key>,
0043         Compare
0044       >::type,
0045       typename boost::mpl::if_<
0046         mpl::is_na<Allocator>,
0047         std::allocator<Entry>,
0048         Allocator
0049       >::type
0050     >
0051   >
0052 {
0053 public:
0054   typedef set_factory_class type;
0055   BOOST_MPL_AUX_LAMBDA_SUPPORT(
0056     4,set_factory_class,(Entry,Key,Compare,Allocator))
0057 };
0058 
0059 /* set_factory_class specifier */
0060 
0061 template<
0062   typename Compare,typename Allocator
0063   BOOST_FLYWEIGHT_NOT_A_PLACEHOLDER_EXPRESSION_DEF
0064 >
0065 struct set_factory:factory_marker
0066 {
0067   template<typename Entry,typename Key>
0068   struct apply:
0069     mpl::apply2<
0070       set_factory_class<
0071         boost::mpl::_1,boost::mpl::_2,Compare,Allocator
0072       >,
0073       Entry,Key
0074     >
0075   {};
0076 };
0077 
0078 } /* namespace flyweights */
0079 
0080 } /* namespace boost */
0081 
0082 #endif