Commit 55aa4367 authored by Davis King's avatar Davis King

Added the bound_function_pointer object.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402669
parent 1e6a2f15
// Copyright (C) 2008 Davis E. King (davisking@users.sourceforge.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_BOUND_FUNCTION_POINTEr_
#define DLIB_BOUND_FUNCTION_POINTEr_
#include "bound_function_pointer/bound_function_pointer_kernel_1.h"
#include "bound_function_pointer/bound_function_pointer_kernel_c.h"
namespace dlib
{
class bound_function_pointer
{
bound_function_pointer() {}
public:
//----------- kernels ---------------
// kernel_1a
typedef bound_function_pointer_kernel_1
kernel_1a;
typedef bound_function_pointer_kernel_c<kernel_1a>
kernel_1a_c;
};
}
#endif // DLIB_BOUND_FUNCTION_POINTEr_
This diff is collapsed.
// Copyright (C) 2008 Davis E. King (davisking@users.sourceforge.net)
// License: Boost Software License See LICENSE.txt for the full license.
#ifndef DLIB_BOUND_FUNCTION_POINTER_KERNEl_C_
#define DLIB_BOUND_FUNCTION_POINTER_KERNEl_C_
#include "bound_function_pointer_kernel_abstract.h"
#include "../algs.h"
#include "../assert.h"
namespace dlib
{
template <
typename bound_function_pointer_base // is an implementation of bound_function_pointer_kernel_abstract.h
>
class bound_function_pointer_kernel_c : public bound_function_pointer_base
{
public:
void operator () (
) const;
};
template <
typename bound_function_pointer_base
>
inline void swap (
bound_function_pointer_kernel_c<bound_function_pointer_base>& a,
bound_function_pointer_kernel_c<bound_function_pointer_base>& b
) { a.swap(b); }
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
// member function definitions
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
template <
typename bound_function_pointer_base
>
void bound_function_pointer_kernel_c<bound_function_pointer_base>::
operator() (
) const
{
// make sure requires clause is not broken
DLIB_CASSERT(this->is_set() == true ,
"\tvoid bound_function_pointer::operator()"
<< "\n\tYou must call set() before you can use this function"
<< "\n\tthis: " << this
);
// call the real function
bound_function_pointer_base::operator()();
}
// ----------------------------------------------------------------------------------------
}
#endif // DLIB_BOUND_FUNCTION_POINTER_KERNEl_C_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment