1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/stdapis/boost/ptr_container/ptr_set.hpp Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,134 @@
1.4 +//
1.5 +// Boost.Pointer Container
1.6 +//
1.7 +// Copyright Thorsten Ottosen 2003-2005. Use, modification and
1.8 +// distribution is subject to the Boost Software License, Version
1.9 +// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
1.10 +// http://www.boost.org/LICENSE_1_0.txt)
1.11 +//
1.12 +// For more information, see http://www.boost.org/libs/ptr_container/
1.13 +//
1.14 +
1.15 +#ifndef BOOST_PTR_CONTAINER_PTR_SET_HPP
1.16 +#define BOOST_PTR_CONTAINER_PTR_SET_HPP
1.17 +
1.18 +#if defined(_MSC_VER) && (_MSC_VER >= 1200)
1.19 +# pragma once
1.20 +#endif
1.21 +
1.22 +#include <boost/ptr_container/indirect_fun.hpp>
1.23 +#include <boost/ptr_container/ptr_set_adapter.hpp>
1.24 +#include <set>
1.25 +
1.26 +namespace boost
1.27 +{
1.28 +
1.29 + template
1.30 + <
1.31 + class Key,
1.32 + class Compare = std::less<Key>,
1.33 + class CloneAllocator = heap_clone_allocator,
1.34 + class Allocator = std::allocator<void*>
1.35 + >
1.36 + class ptr_set :
1.37 + public ptr_set_adapter< Key,
1.38 + std::set<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
1.39 + CloneAllocator >
1.40 + {
1.41 + typedef ptr_set_adapter< Key, std::set<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
1.42 + CloneAllocator >
1.43 + base_type;
1.44 +
1.45 + typedef ptr_set<Key,Compare,CloneAllocator,Allocator> this_type;
1.46 +
1.47 + public:
1.48 + explicit ptr_set( const Compare& comp = Compare(),
1.49 + const Allocator& a = Allocator() )
1.50 + : base_type( comp, a )
1.51 + { }
1.52 +
1.53 + template< typename InputIterator >
1.54 + ptr_set( InputIterator first, InputIterator last,
1.55 + const Compare& comp = Compare(),
1.56 + const Allocator& a = Allocator() )
1.57 + : base_type( first, last, comp, a )
1.58 + { }
1.59 +
1.60 + BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_set,
1.61 + base_type,
1.62 + this_type );
1.63 +
1.64 + };
1.65 +
1.66 +
1.67 +
1.68 + template
1.69 + <
1.70 + class Key,
1.71 + class Compare = std::less<Key>,
1.72 + class CloneAllocator = heap_clone_allocator,
1.73 + class Allocator = std::allocator<void*>
1.74 + >
1.75 + class ptr_multiset :
1.76 + public ptr_multiset_adapter< Key,
1.77 + std::multiset<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
1.78 + CloneAllocator >
1.79 + {
1.80 + typedef ptr_multiset_adapter< Key,
1.81 + std::multiset<void*,void_ptr_indirect_fun<Compare,Key>,Allocator>,
1.82 + CloneAllocator >
1.83 + base_type;
1.84 + typedef ptr_multiset<Key,Compare,CloneAllocator,Allocator> this_type;
1.85 +
1.86 + public:
1.87 + explicit ptr_multiset( const Compare& comp = Compare(),
1.88 + const Allocator& a = Allocator() )
1.89 + : base_type( comp, a )
1.90 + { }
1.91 +
1.92 + template< typename InputIterator >
1.93 + ptr_multiset( InputIterator first, InputIterator last,
1.94 + const Compare& comp = Compare(),
1.95 + const Allocator& a = Allocator() )
1.96 + : base_type( first, last, comp, a )
1.97 + { }
1.98 +
1.99 + BOOST_PTR_CONTAINER_DEFINE_RELEASE_AND_CLONE( ptr_multiset,
1.100 + base_type,
1.101 + this_type );
1.102 +
1.103 + };
1.104 +
1.105 + /////////////////////////////////////////////////////////////////////////
1.106 + // clonability
1.107 +
1.108 + template< typename K, typename C, typename CA, typename A >
1.109 + inline ptr_set<K,C,CA,A>* new_clone( const ptr_set<K,C,CA,A>& r )
1.110 + {
1.111 + return r.clone().release();
1.112 + }
1.113 +
1.114 + template< typename K, typename C, typename CA, typename A >
1.115 + inline ptr_multiset<K,C,CA,A>* new_clone( const ptr_multiset<K,C,CA,A>& r )
1.116 + {
1.117 + return r.clone().release();
1.118 + }
1.119 +
1.120 + /////////////////////////////////////////////////////////////////////////
1.121 + // swap
1.122 +
1.123 + template< typename K, typename C, typename CA, typename A >
1.124 + inline void swap( ptr_set<K,C,CA,A>& l, ptr_set<K,C,CA,A>& r )
1.125 + {
1.126 + l.swap(r);
1.127 + }
1.128 +
1.129 + template< typename K, typename C, typename CA, typename A >
1.130 + inline void swap( ptr_multiset<K,C,CA,A>& l, ptr_multiset<K,C,CA,A>& r )
1.131 + {
1.132 + l.swap(r);
1.133 + }
1.134 +
1.135 +}
1.136 +
1.137 +#endif