1 ////////////////////////////////////////////////////////////////////////////// 2 // 3 // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost 4 // Software License, Version 1.0. (See accompanying file 5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 6 // 7 // See http://www.boost.org/libs/interprocess for documentation. 8 // 9 ////////////////////////////////////////////////////////////////////////////// 10 #ifndef BOOST_INTERPROCESS_NULL_INDEX_HPP 11 #define BOOST_INTERPROCESS_NULL_INDEX_HPP 12 13 #ifndef BOOST_CONFIG_HPP 14 # include <boost/config.hpp> 15 #endif 16 # 17 #if defined(BOOST_HAS_PRAGMA_ONCE) 18 # pragma once 19 #endif 20 21 #include <boost/interprocess/detail/config_begin.hpp> 22 #include <boost/interprocess/detail/workaround.hpp> 23 24 #include <boost/interprocess/offset_ptr.hpp> 25 26 //!\file 27 //!Describes a null index adaptor, so that if we don't want to construct 28 //!named objects, we can use this null index type to save resources. 29 30 namespace boost { 31 namespace interprocess { 32 33 //!Null index type 34 //!used to save compilation time when 35 //!named indexes are not needed. 36 template <class MapConfig> 37 class null_index 38 { 39 #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) 40 typedef typename MapConfig:: 41 segment_manager_base segment_manager_base; 42 #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED 43 44 public: 45 typedef int * iterator; 46 typedef const int * const_iterator; 47 48 //!begin() is equal 49 //!to end() begin() const50 const_iterator begin() const 51 { return const_iterator(0); } 52 53 //!begin() is equal 54 //!to end() begin()55 iterator begin() 56 { return iterator(0); } 57 58 //!begin() is equal 59 //!to end() end() const60 const_iterator end() const 61 { return const_iterator(0); } 62 63 //!begin() is equal 64 //!to end() end()65 iterator end() 66 { return iterator(0); } 67 68 //!Empty constructor null_index(segment_manager_base *)69 null_index(segment_manager_base *){} 70 }; 71 72 }} //namespace boost { namespace interprocess { 73 74 #include <boost/interprocess/detail/config_end.hpp> 75 76 #endif //#ifndef BOOST_INTERPROCESS_NULL_INDEX_HPP 77