Mercurial > hg > vamp-build-and-test
annotate DEPENDENCIES/generic/include/boost/flyweight/static_holder.hpp @ 125:34e428693f5d vext
Vext -> Repoint
author | Chris Cannam |
---|---|
date | Thu, 14 Jun 2018 11:15:39 +0100 |
parents | c530137014c0 |
children |
rev | line source |
---|---|
Chris@16 | 1 /* Copyright 2006-2009 Joaquin M Lopez Munoz. |
Chris@16 | 2 * Distributed under the Boost Software License, Version 1.0. |
Chris@16 | 3 * (See accompanying file LICENSE_1_0.txt or copy at |
Chris@16 | 4 * http://www.boost.org/LICENSE_1_0.txt) |
Chris@16 | 5 * |
Chris@16 | 6 * See http://www.boost.org/libs/flyweight for library home page. |
Chris@16 | 7 */ |
Chris@16 | 8 |
Chris@16 | 9 #ifndef BOOST_FLYWEIGHT_STATIC_HOLDER_HPP |
Chris@16 | 10 #define BOOST_FLYWEIGHT_STATIC_HOLDER_HPP |
Chris@16 | 11 |
Chris@101 | 12 #if defined(_MSC_VER) |
Chris@16 | 13 #pragma once |
Chris@16 | 14 #endif |
Chris@16 | 15 |
Chris@16 | 16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ |
Chris@16 | 17 #include <boost/flyweight/static_holder_fwd.hpp> |
Chris@16 | 18 #include <boost/flyweight/holder_tag.hpp> |
Chris@16 | 19 #include <boost/mpl/aux_/lambda_support.hpp> |
Chris@16 | 20 |
Chris@16 | 21 /* Simplest holder storing the T object as a local static variable. |
Chris@16 | 22 */ |
Chris@16 | 23 |
Chris@16 | 24 namespace boost{ |
Chris@16 | 25 |
Chris@16 | 26 namespace flyweights{ |
Chris@16 | 27 |
Chris@16 | 28 template<typename C> |
Chris@16 | 29 struct static_holder_class:holder_marker |
Chris@16 | 30 { |
Chris@16 | 31 static C& get() |
Chris@16 | 32 { |
Chris@16 | 33 static C c; |
Chris@16 | 34 return c; |
Chris@16 | 35 } |
Chris@16 | 36 |
Chris@16 | 37 typedef static_holder_class type; |
Chris@16 | 38 BOOST_MPL_AUX_LAMBDA_SUPPORT(1,static_holder_class,(C)) |
Chris@16 | 39 }; |
Chris@16 | 40 |
Chris@16 | 41 /* static_holder_class specifier */ |
Chris@16 | 42 |
Chris@16 | 43 struct static_holder:holder_marker |
Chris@16 | 44 { |
Chris@16 | 45 template<typename C> |
Chris@16 | 46 struct apply |
Chris@16 | 47 { |
Chris@16 | 48 typedef static_holder_class<C> type; |
Chris@16 | 49 }; |
Chris@16 | 50 }; |
Chris@16 | 51 |
Chris@16 | 52 } /* namespace flyweights */ |
Chris@16 | 53 |
Chris@16 | 54 } /* namespace boost */ |
Chris@16 | 55 |
Chris@16 | 56 #endif |