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