~ubuntu-branches/ubuntu/wily/bombono-dvd/wily

« back to all changes in this revision

Viewing changes to libs/boost-lib/boost/bind/make_adaptable.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-11-04 11:46:25 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20101104114625-8xfdhvhpsm51i0nu
Tags: upstream-0.8.0
ImportĀ upstreamĀ versionĀ 0.8.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED
 
2
#define BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED
 
3
 
 
4
//
 
5
//  make_adaptable.hpp
 
6
//
 
7
//  Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
 
8
//
 
9
// Distributed under the Boost Software License, Version 1.0. (See
 
10
// accompanying file LICENSE_1_0.txt or copy at
 
11
// http://www.boost.org/LICENSE_1_0.txt)
 
12
//
 
13
 
 
14
namespace boost
 
15
{
 
16
 
 
17
namespace _bi
 
18
{
 
19
 
 
20
template<class R, class F> class af0
 
21
{
 
22
public:
 
23
 
 
24
    typedef R result_type;
 
25
 
 
26
    explicit af0(F f): f_(f)
 
27
    {
 
28
    }
 
29
 
 
30
    result_type operator()()
 
31
    {
 
32
        return f_();
 
33
    }
 
34
 
 
35
    result_type operator()() const
 
36
    {
 
37
        return f_();
 
38
    }
 
39
 
 
40
private:
 
41
 
 
42
    F f_;
 
43
};
 
44
 
 
45
template<class R, class A1, class F> class af1
 
46
{
 
47
public:
 
48
 
 
49
    typedef R result_type;
 
50
    typedef A1 argument_type;
 
51
    typedef A1 arg1_type;
 
52
 
 
53
    explicit af1(F f): f_(f)
 
54
    {
 
55
    }
 
56
 
 
57
    result_type operator()(A1 a1)
 
58
    {
 
59
        return f_(a1);
 
60
    }
 
61
 
 
62
    result_type operator()(A1 a1) const
 
63
    {
 
64
        return f_(a1);
 
65
    }
 
66
 
 
67
private:
 
68
 
 
69
    F f_;
 
70
};
 
71
 
 
72
template<class R, class A1, class A2, class F> class af2
 
73
{
 
74
public:
 
75
 
 
76
    typedef R result_type;
 
77
    typedef A1 first_argument_type;
 
78
    typedef A2 second_argument_type;
 
79
    typedef A1 arg1_type;
 
80
    typedef A2 arg2_type;
 
81
 
 
82
    explicit af2(F f): f_(f)
 
83
    {
 
84
    }
 
85
 
 
86
    result_type operator()(A1 a1, A2 a2)
 
87
    {
 
88
        return f_(a1, a2);
 
89
    }
 
90
 
 
91
    result_type operator()(A1 a1, A2 a2) const
 
92
    {
 
93
        return f_(a1, a2);
 
94
    }
 
95
 
 
96
private:
 
97
 
 
98
    F f_;
 
99
};
 
100
 
 
101
template<class R, class A1, class A2, class A3, class F> class af3
 
102
{
 
103
public:
 
104
 
 
105
    typedef R result_type;
 
106
    typedef A1 arg1_type;
 
107
    typedef A2 arg2_type;
 
108
    typedef A3 arg3_type;
 
109
 
 
110
    explicit af3(F f): f_(f)
 
111
    {
 
112
    }
 
113
 
 
114
    result_type operator()(A1 a1, A2 a2, A3 a3)
 
115
    {
 
116
        return f_(a1, a2, a3);
 
117
    }
 
118
 
 
119
    result_type operator()(A1 a1, A2 a2, A3 a3) const
 
120
    {
 
121
        return f_(a1, a2, a3);
 
122
    }
 
123
 
 
124
private:
 
125
 
 
126
    F f_;
 
127
};
 
128
 
 
129
template<class R, class A1, class A2, class A3, class A4, class F> class af4
 
130
{
 
131
public:
 
132
 
 
133
    typedef R result_type;
 
134
    typedef A1 arg1_type;
 
135
    typedef A2 arg2_type;
 
136
    typedef A3 arg3_type;
 
137
    typedef A4 arg4_type;
 
138
 
 
139
    explicit af4(F f): f_(f)
 
140
    {
 
141
    }
 
142
 
 
143
    result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4)
 
144
    {
 
145
        return f_(a1, a2, a3, a4);
 
146
    }
 
147
 
 
148
    result_type operator()(A1 a1, A2 a2, A3 a3, A4 a4) const
 
149
    {
 
150
        return f_(a1, a2, a3, a4);
 
151
    }
 
152
 
 
153
private:
 
154
 
 
155
    F f_;
 
156
};
 
157
 
 
158
} // namespace _bi
 
159
 
 
160
template<class R, class F> _bi::af0<R, F> make_adaptable(F f)
 
161
{
 
162
    return _bi::af0<R, F>(f);
 
163
}
 
164
 
 
165
template<class R, class A1, class F> _bi::af1<R, A1, F> make_adaptable(F f)
 
166
{
 
167
    return _bi::af1<R, A1, F>(f);
 
168
}
 
169
 
 
170
template<class R, class A1, class A2, class F> _bi::af2<R, A1, A2, F> make_adaptable(F f)
 
171
{
 
172
    return _bi::af2<R, A1, A2, F>(f);
 
173
}
 
174
 
 
175
template<class R, class A1, class A2, class A3, class F> _bi::af3<R, A1, A2, A3, F> make_adaptable(F f)
 
176
{
 
177
    return _bi::af3<R, A1, A2, A3, F>(f);
 
178
}
 
179
 
 
180
template<class R, class A1, class A2, class A3, class A4, class F> _bi::af4<R, A1, A2, A3, A4, F> make_adaptable(F f)
 
181
{
 
182
    return _bi::af4<R, A1, A2, A3, A4, F>(f);
 
183
}
 
184
 
 
185
} // namespace boost
 
186
 
 
187
#endif // #ifndef BOOST_BIND_MAKE_ADAPTABLE_HPP_INCLUDED