• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Copyright 2016-2017 Joaquin M Lopez Munoz.
2  * Distributed under the Boost Software License, Version 1.0.
3  * (See accompanying file LICENSE_1_0.txt or copy at
4  * http://www.boost.org/LICENSE_1_0.txt)
5  *
6  * See http://www.boost.org/libs/poly_collection for library home page.
7  */
8 
9 #ifndef BOOST_POLY_COLLECTION_BASE_COLLECTION_HPP
10 #define BOOST_POLY_COLLECTION_BASE_COLLECTION_HPP
11 
12 #if defined(_MSC_VER)
13 #pragma once
14 #endif
15 
16 #include <boost/poly_collection/base_collection_fwd.hpp>
17 #include <boost/poly_collection/detail/base_model.hpp>
18 #include <boost/poly_collection/detail/poly_collection.hpp>
19 #include <utility>
20 
21 namespace boost{
22 
23 namespace poly_collection{
24 
25 template<typename Base,typename Allocator>
26 class base_collection:
27  public common_impl::poly_collection<detail::base_model<Base>,Allocator>
28 {
29   using base_type=common_impl::poly_collection<
30     detail::base_model<Base>,Allocator>;
31 
base()32   base_type&       base()noexcept{return *this;}
base() const33   const base_type& base()const noexcept{return *this;}
34 
35 public:
36   using base_type::base_type;
37 
38   base_collection()=default;
39   base_collection(const base_collection& x)=default;
40   base_collection(base_collection&& x)=default;
41   base_collection& operator=(const base_collection& x)=default;
42   base_collection& operator=(base_collection&& x)=default;
43 
44   template<typename B,typename A>
45   friend bool operator==(
46     const base_collection<B,A>&,const base_collection<B,A>&);
47 };
48 
49 template<typename Base,typename Allocator>
operator ==(const base_collection<Base,Allocator> & x,const base_collection<Base,Allocator> & y)50 bool operator==(
51   const base_collection<Base,Allocator>& x,
52   const base_collection<Base,Allocator>& y)
53 {
54   return x.base()==y.base();
55 }
56 
57 template<typename Base,typename Allocator>
operator !=(const base_collection<Base,Allocator> & x,const base_collection<Base,Allocator> & y)58 bool operator!=(
59   const base_collection<Base,Allocator>& x,
60   const base_collection<Base,Allocator>& y)
61 {
62  return !(x==y);
63 }
64 
65 template<typename Base,typename Allocator>
swap(base_collection<Base,Allocator> & x,base_collection<Base,Allocator> & y)66 void swap(
67   base_collection<Base,Allocator>& x,base_collection<Base,Allocator>& y)
68 {
69   x.swap(y);
70 }
71 
72 } /* namespace  */
73 
74 using poly_collection::base_collection;
75 
76 } /* namespace boost */
77 
78 #endif
79