ptr_deque.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // Boost.Pointer Container
  3. //
  4. // Copyright Thorsten Ottosen 2003-2005. Use, modification and
  5. // distribution is subject to the Boost Software License, Version
  6. // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // For more information, see http://www.boost.org/libs/ptr_container/
  10. //
  11. #ifndef BOOST_PTR_CONTAINER_PTR_DEQUE_HPP
  12. #define BOOST_PTR_CONTAINER_PTR_DEQUE_HPP
  13. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  14. # pragma once
  15. #endif
  16. #include <deque>
  17. #include <boost/ptr_container/ptr_sequence_adapter.hpp>
  18. namespace boost
  19. {
  20. template
  21. <
  22. class T,
  23. class CloneAllocator = heap_clone_allocator,
  24. class Allocator = std::allocator<void*>
  25. >
  26. class ptr_deque : public
  27. ptr_sequence_adapter< T,
  28. std::deque<void*,Allocator>,
  29. CloneAllocator >
  30. {
  31. typedef ptr_sequence_adapter< T,
  32. std::deque<void*,Allocator>,
  33. CloneAllocator >
  34. base_class;
  35. typedef ptr_deque<T,CloneAllocator,Allocator> this_type;
  36. public:
  37. BOOST_PTR_CONTAINER_DEFINE_SEQEUENCE_MEMBERS( ptr_deque,
  38. base_class,
  39. this_type )
  40. };
  41. //////////////////////////////////////////////////////////////////////////////
  42. // clonability
  43. template< typename T, typename CA, typename A >
  44. inline ptr_deque<T,CA,A>* new_clone( const ptr_deque<T,CA,A>& r )
  45. {
  46. return r.clone().release();
  47. }
  48. /////////////////////////////////////////////////////////////////////////
  49. // swap
  50. template< typename T, typename CA, typename A >
  51. inline void swap( ptr_deque<T,CA,A>& l, ptr_deque<T,CA,A>& r )
  52. {
  53. l.swap(r);
  54. }
  55. }
  56. #endif