libzypp
17.25.6
Function.h
Go to the documentation of this file.
1
/*---------------------------------------------------------------------\
2
| ____ _ __ __ ___ |
3
| |__ / \ / / . \ . \ |
4
| / / \ V /| _/ _/ |
5
| / /__ | | | | | | |
6
| /_____||_| |_| |_| |
7
| |
8
\---------------------------------------------------------------------*/
12
#ifndef ZYPP_BASE_FUNCTION_H
13
#define ZYPP_BASE_FUNCTION_H
14
15
#include <boost/function.hpp>
16
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
17
#include <boost/bind.hpp>
18
#include <boost/ref.hpp>
19
21
namespace
zypp
22
{
23
24
/* http://www.boost.org/doc/html/function.html
25
26
The Boost.Function library contains a family of class templates
27
that are function object wrappers. The notion is similar to a
28
generalized callback. It shares features with function pointers
29
in that both define a call interface (e.g., a function taking
30
two integer arguments and returning a floating-point value)
31
through which some implementation can be called, and the
32
implementation that is invoked may change throughout the
33
course of the program.
34
35
Generally, any place in which a function pointer would be used
36
to defer a call or make a callback, Boost.Function can be used
37
instead to allow the user greater flexibility in the implementation
38
of the target. Targets can be any 'compatible' function object
39
(or function pointer), meaning that the arguments to the interface
40
designated by Boost.Function can be converted to the arguments of
41
the target function object.
42
*/
43
using
boost::function;
44
45
/* http://www.boost.org/libs/bind/bind.html
46
47
boost::bind is a generalization of the standard functions std::bind1st
48
and std::bind2nd. It supports arbitrary function objects, functions,
49
function pointers, and member function pointers, and is able to bind
50
any argument to a specific value or route input arguments into arbitrary
51
positions. bind does not place any requirements on the function object;
52
in particular, it does not need the result_type, first_argument_type and
53
second_argument_type standard typedefs.
54
*/
55
using
boost::bind;
56
57
/* http://www.boost.org/doc/html/ref.html
58
59
The Ref library is a small library that is useful for passing references
60
to function templates (algorithms) that would usually take copies of their
61
arguments. It defines the class template boost::reference_wrapper<T>, the
62
two functions boost::ref and boost::cref that return instances of
63
boost::reference_wrapper<T>, and the two traits classes
64
boost::is_reference_wrapper<T> and boost::unwrap_reference<T>.
65
66
The purpose of boost::reference_wrapper<T> is to contain a reference to an
67
object of type T. It is primarily used to "feed" references to function
68
templates (algorithms) that take their parameter by value.
69
70
To support this usage, boost::reference_wrapper<T> provides an implicit
71
conversion to T&. This usually allows the function templates to work on
72
references unmodified.
73
*/
74
using
boost::ref;
75
77
}
// namespace zypp
79
#endif // ZYPP_BASE_FUNCTION_H
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition:
CodePitfalls.doc:2
zypp
base
Function.h
Generated by
1.8.20