/usr/include/polybori/ring/CMemberFunctionTraits.h is in libbrial-dev 0.8.5-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | // -*- c++ -*-
//*****************************************************************************
/** @file CMemberFunctionTraits.h
*
* @author Alexander Dreyer
* @date 2010-08-30
*
* This file define a template, which extracts related types from a member
* function pointer.
*
* We use the notation of boost::function_traits as much as possible.
*
* @par Copyright:
* (c) 2010 by The PolyBoRi Team
*
**/
//*****************************************************************************
#ifndef polybori_ring_CMemberFunctionTraits_h_
#define polybori_ring_CMemberFunctionTraits_h_
// include basic definitions
#include <polybori/pbori_defs.h>
BEGIN_NAMESPACE_PBORI
/** @class CMemberFunctionTraits
* @brief This template class defines related types for member function pointer.
*
* @note Currently, the class supports functions with up to one argument only.
**/
template<class MemberFuncPtr>
class CMemberFunctionTraits;
/// Axuiliary class
template <class Type, class ResultType, class ArgType, class ObjRef>
class CMemberFunctionTraitsBase {
public:
typedef ResultType result_type;
typedef ArgType argument_type;
typedef Type object_type;
typedef ObjRef object_reference;
};
template <class Type, class ResultType>
class CMemberFunctionTraits<ResultType (Type::*)()>:
public CMemberFunctionTraitsBase<Type, ResultType, void, Type&> { };
template <class Type, class ResultType>
class CMemberFunctionTraits<ResultType (Type::*)() const>:
public CMemberFunctionTraitsBase<Type, ResultType, void, const Type&> { };
template <class Type, class ResultType, class ArgType>
class CMemberFunctionTraits<ResultType (Type::*)(ArgType)>:
public CMemberFunctionTraitsBase<Type, ResultType, ArgType, Type&> { };
template <class Type, class ResultType, class ArgType>
class CMemberFunctionTraits<ResultType (Type::*)(ArgType) const>:
public CMemberFunctionTraitsBase<Type, ResultType, ArgType, const Type&> { };
template <class MemberFct>
class MemberFunctionOperator {
typedef CMemberFunctionTraits<MemberFct> traits;
public:
MemberFunctionOperator(MemberFct func): m_func(func) {}
typename traits::result_type operator()(typename traits::object_reference obj,
typename traits::argument_type arg) {
return (obj .* m_func)(arg);
}
private:
MemberFct m_func;
};
template <class MemberFct>
MemberFunctionOperator<MemberFct>
member_function_operator(MemberFct func) {
return MemberFunctionOperator<MemberFct>(func);
}
END_NAMESPACE_PBORI
#endif
|