/usr/include/boost/container/detail
NameSizeModeActions
adaptive_node_pool.hpp55690644editdlrm
adaptive_node_pool_impl.hpp540880644editdlrm
addressof.hpp10630644editdlrm
advanced_insert_int.hpp176680644editdlrm
algorithm.hpp38800644editdlrm
allocation_type.hpp20170644editdlrm
allocator_version_traits.hpp56320644editdlrm
alloc_helpers.hpp18670644editdlrm
alloc_lib.h117420644editdlrm
auto_link.hpp16570644editdlrm
block_list.hpp41990644editdlrm
block_slist.hpp45030644editdlrm
compare_functors.hpp39920644editdlrm
config_begin.hpp36370644editdlrm
config_end.hpp4800644editdlrm
construct_in_place.hpp29520644editdlrm
container_or_allocator_rebind.hpp17430644editdlrm
container_rebind.hpp66100644editdlrm
copy_move_algo.hpp385310644editdlrm
destroyers.hpp93380644editdlrm
dispatch_uses_allocator.hpp197330644editdlrm
dlmalloc.hpp34440644editdlrm
flat_tree.hpp616630644editdlrm
function_detector.hpp35580644editdlrm
is_container.hpp22130644editdlrm
is_contiguous_container.hpp17120644editdlrm
is_sorted.hpp14650644editdlrm
iterator.hpp25900644editdlrm
iterators.hpp298820644editdlrm
iterator_to_raw_pointer.hpp9710644editdlrm
math_functions.hpp38720644editdlrm
minimal_char_traits_header.hpp10570644editdlrm
min_max.hpp9970644editdlrm
mpl.hpp38340644editdlrm
multiallocation_chain.hpp103170644editdlrm
mutex.hpp86650644editdlrm
next_capacity.hpp21400644editdlrm
node_alloc_holder.hpp176510644editdlrm
node_pool.hpp48080644editdlrm
node_pool_impl.hpp131710644editdlrm
pair.hpp212810644editdlrm
pair_key_mapped_of_value.hpp14660644editdlrm
placement_new.hpp9140644editdlrm
pool_common.hpp16060644editdlrm
pool_common_alloc.hpp27300644editdlrm
pool_resource.hpp77440644editdlrm
singleton.hpp44650644editdlrm
std_fwd.hpp14500644editdlrm
thread_mutex.hpp44490644editdlrm
transform_iterator.hpp51030644editdlrm
tree.hpp570380644editdlrm
type_traits.hpp27140644editdlrm
value_functors.hpp11180644editdlrm
value_init.hpp11350644editdlrm
variadic_templates_tools.hpp49590644editdlrm
version_type.hpp24160644editdlrm
workaround.hpp45010644editdlrm
Edit: /usr/include/boost/container/detail/singleton.hpp (4465B)
// Copyright (C) 2000 Stephen Cleary // Copyright (C) 2008 Ion Gaztanaga // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org for updates, documentation, and revision history. // // This file is a modified file from Boost.Pool ////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2007-2013. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_CONTAINER_DETAIL_SINGLETON_DETAIL_HPP #define BOOST_CONTAINER_DETAIL_SINGLETON_DETAIL_HPP #ifndef BOOST_CONFIG_HPP # include #endif #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif #include #include // // The following helper classes are placeholders for a generic "singleton" // class. The classes below support usage of singletons, including use in // program startup/shutdown code, AS LONG AS there is only one thread // running before main() begins, and only one thread running after main() // exits. // // This class is also limited in that it can only provide singleton usage for // classes with default constructors. // // The design of this class is somewhat twisted, but can be followed by the // calling inheritance. Let us assume that there is some user code that // calls "singleton_default::instance()". The following (convoluted) // sequence ensures that the same function will be called before main(): // instance() contains a call to create_object.do_nothing() // Thus, object_creator is implicitly instantiated, and create_object // must exist. // Since create_object is a static member, its constructor must be // called before main(). // The constructor contains a call to instance(), thus ensuring that // instance() will be called before main(). // The first time instance() is called (i.e., before main()) is the // latest point in program execution where the object of type T // can be created. // Thus, any call to instance() will auto-magically result in a call to // instance() before main(), unless already present. // Furthermore, since the instance() function contains the object, instead // of the singleton_default class containing a static instance of the // object, that object is guaranteed to be constructed (at the latest) in // the first call to instance(). This permits calls to instance() from // static code, even if that code is called before the file-scope objects // in this file have been initialized. namespace boost { namespace container { namespace dtl { // T must be: no-throw default constructible and no-throw destructible template struct singleton_default { private: struct object_creator { // This constructor does nothing more than ensure that instance() // is called before main() begins, thus creating the static // T object before multithreading race issues can come up. object_creator() { singleton_default::instance(); } inline void do_nothing() const { } }; static object_creator create_object; singleton_default(); public: typedef T object_type; // If, at any point (in user code), singleton_default::instance() // is called, then the following function is instantiated. static object_type & instance() { // This is the object that we return a reference to. // It is guaranteed to be created before main() begins because of // the next line. static object_type obj; // The following line does nothing else than force the instantiation // of singleton_default::create_object, whose constructor is // called before main() begins. create_object.do_nothing(); return obj; } }; template typename singleton_default::object_creator singleton_default::create_object; } // namespace dtl } // namespace container } // namespace boost #include #endif //BOOST_CONTAINER_DETAIL_SINGLETON_DETAIL_HPP