fix doc example typo
[boost.git] / boost / intrusive / detail / ebo_functor_holder.hpp
blob35628f2d8f8169fdcd7279864bca26523ef62780
1 /////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) Copyright Joaquin M Lopez Munoz 2006-2008
4 //
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
8 //
9 // See http://www.boost.org/libs/intrusive for documentation.
11 /////////////////////////////////////////////////////////////////////////////
13 #ifndef BOOST_INTRUSIVE_DETAIL_EBO_HOLDER_HPP
14 #define BOOST_INTRUSIVE_DETAIL_EBO_HOLDER_HPP
16 #include <boost/intrusive/detail/mpl.hpp>
18 namespace boost {
19 namespace intrusive {
20 namespace detail {
22 template<typename T, bool IsEmpty = true>
23 class ebo_functor_holder_impl
25 public:
26 ebo_functor_holder_impl()
28 ebo_functor_holder_impl(const T& t)
29 : t_(t)
31 template<class Arg1, class Arg2>
32 ebo_functor_holder_impl(const Arg1& arg1, const Arg2& arg2)
33 : t_(arg1, arg2)
36 T& get(){return t_;}
37 const T& get()const{return t_;}
39 private:
40 T t_;
43 template<typename T>
44 class ebo_functor_holder_impl<T, false>
45 : public T
47 public:
48 ebo_functor_holder_impl()
50 ebo_functor_holder_impl(const T& t)
51 : T(t)
53 template<class Arg1, class Arg2>
54 ebo_functor_holder_impl(const Arg1& arg1, const Arg2& arg2)
55 : T(arg1, arg2)
58 T& get(){return *this;}
59 const T& get()const{return *this;}
62 template<typename T>
63 class ebo_functor_holder
64 : public ebo_functor_holder_impl<T, is_unary_or_binary_function<T>::value>
66 private:
67 typedef ebo_functor_holder_impl<T, is_unary_or_binary_function<T>::value> super;
69 public:
70 ebo_functor_holder(){}
71 ebo_functor_holder(const T& t)
72 : super(t)
75 template<class Arg1, class Arg2>
76 ebo_functor_holder(const Arg1& arg1, const Arg2& arg2)
77 : super(arg1, arg2)
80 ebo_functor_holder& operator=(const ebo_functor_holder& x)
82 this->get()=x.get();
83 return *this;
88 } //namespace detail {
89 } //namespace intrusive {
90 } //namespace boost {
92 #endif //#ifndef BOOST_INTRUSIVE_DETAIL_EBO_HOLDER_HPP