• 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_FUNCTION_COLLECTION_HPP
10 #define BOOST_POLY_COLLECTION_FUNCTION_COLLECTION_HPP
11 
12 #if defined(_MSC_VER)
13 #pragma once
14 #endif
15 
16 #include <boost/poly_collection/function_collection_fwd.hpp>
17 #include <boost/poly_collection/detail/function_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 Signature,typename Allocator>
26 class function_collection:
27  public common_impl::poly_collection<
28    detail::function_model<Signature>,Allocator>
29 {
30   using base_type=common_impl::poly_collection<
31     detail::function_model<Signature>,Allocator>;
32 
base()33   base_type&       base()noexcept{return *this;}
base() const34   const base_type& base()const noexcept{return *this;}
35 
36 public:
37   using base_type::base_type;
38 
39   function_collection()=default;
40   function_collection(const function_collection& x)=default;
41   function_collection(function_collection&& x)=default;
42   function_collection& operator=(const function_collection& x)=default;
43   function_collection& operator=(function_collection&& x)=default;
44 
45   template<typename S,typename A>
46   friend bool operator==(
47     const function_collection<S,A>&,const function_collection<S,A>&);
48 };
49 
50 template<typename Signature,typename Allocator>
operator ==(const function_collection<Signature,Allocator> & x,const function_collection<Signature,Allocator> & y)51 bool operator==(
52   const function_collection<Signature,Allocator>& x,
53   const function_collection<Signature,Allocator>& y)
54 {
55   return x.base()==y.base();
56 }
57 
58 template<typename Signature,typename Allocator>
operator !=(const function_collection<Signature,Allocator> & x,const function_collection<Signature,Allocator> & y)59 bool operator!=(
60   const function_collection<Signature,Allocator>& x,
61   const function_collection<Signature,Allocator>& y)
62 {
63  return !(x==y);
64 }
65 
66 template<typename Signature,typename Allocator>
swap(function_collection<Signature,Allocator> & x,function_collection<Signature,Allocator> & y)67 void swap(
68   function_collection<Signature,Allocator>& x,
69   function_collection<Signature,Allocator>& y)
70 {
71   x.swap(y);
72 }
73 
74 } /* namespace  */
75 
76 using poly_collection::function_collection;
77 
78 } /* namespace boost */
79 
80 #endif
81