libzypp  10.5.0
Function.h
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_BASE_FUNCTION_H
00013 #define ZYPP_BASE_FUNCTION_H
00014 
00015 #include <boost/function.hpp>
00016 #include <boost/bind.hpp>
00017 #include <boost/ref.hpp>
00018 
00020 namespace zypp
00021 { 
00022 
00023   /* http://www.boost.org/doc/html/function.html
00024 
00025    The Boost.Function library contains a family of class templates
00026    that are function object wrappers. The notion is similar to a
00027    generalized callback. It shares features with function pointers
00028    in that both define a call interface (e.g., a function taking
00029    two integer arguments and returning a floating-point value)
00030    through which some implementation can be called, and the
00031    implementation that is invoked may change throughout the
00032    course of the program.
00033 
00034    Generally, any place in which a function pointer would be used
00035    to defer a call or make a callback, Boost.Function can be used
00036    instead to allow the user greater flexibility in the implementation
00037    of the target. Targets can be any 'compatible' function object
00038    (or function pointer), meaning that the arguments to the interface
00039    designated by Boost.Function can be converted to the arguments of
00040    the target function object.
00041   */
00042   using boost::function;
00043 
00044   /* http://www.boost.org/libs/bind/bind.html
00045 
00046    boost::bind is a generalization of the standard functions std::bind1st
00047    and std::bind2nd. It supports arbitrary function objects, functions,
00048    function pointers, and member function pointers, and is able to bind
00049    any argument to a specific value or route input arguments into arbitrary
00050    positions. bind  does not place any requirements on the function object;
00051    in particular, it does not need the result_type, first_argument_type and
00052    second_argument_type  standard typedefs.
00053   */
00054   using boost::bind;
00055 
00056   /* http://www.boost.org/doc/html/ref.html
00057 
00058    The Ref library is a small library that is useful for passing references
00059    to function templates (algorithms) that would usually take copies of their
00060    arguments. It defines the class template boost::reference_wrapper<T>, the
00061    two functions boost::ref and boost::cref that return instances of
00062    boost::reference_wrapper<T>, and the two traits classes
00063    boost::is_reference_wrapper<T>  and boost::unwrap_reference<T>.
00064 
00065    The purpose of boost::reference_wrapper<T> is to contain a reference to an
00066    object of type T. It is primarily used to "feed" references to function
00067    templates (algorithms) that take their parameter by value.
00068 
00069    To support this usage, boost::reference_wrapper<T> provides an implicit
00070    conversion to T&. This usually allows the function templates to work on
00071    references unmodified.
00072   */
00073   using boost::ref;
00074 
00076 } // namespace zypp
00078 #endif // ZYPP_BASE_FUNCTION_H