mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-06 22:29:23 +00:00
rtorrent: Working on display.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@237 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -0,0 +1,157 @@
|
||||
#ifndef ALGO_COMMON_H
|
||||
#define ALGO_COMMON_H
|
||||
|
||||
namespace algo {
|
||||
|
||||
struct _nil {
|
||||
};
|
||||
|
||||
struct _one {
|
||||
char c[1];
|
||||
};
|
||||
|
||||
struct _two {
|
||||
char c[2];
|
||||
};
|
||||
|
||||
template <bool C, typename Then, typename Else>
|
||||
struct tmpl_if;
|
||||
|
||||
template <typename Then, typename Else>
|
||||
struct tmpl_if<true, Then, Else> {
|
||||
typedef Then result;
|
||||
};
|
||||
|
||||
template <typename Then, typename Else>
|
||||
struct tmpl_if<false, Then, Else> {
|
||||
typedef Else result;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct traits {
|
||||
enum {
|
||||
REF = false,
|
||||
CONST = false
|
||||
};
|
||||
|
||||
typedef T orig_t;
|
||||
typedef T type_t;
|
||||
typedef T& ref_t;
|
||||
|
||||
typedef T b_orig_t;
|
||||
typedef T b_type_t;
|
||||
typedef T& b_ref_t;
|
||||
|
||||
typedef const T c_orig_t;
|
||||
typedef const T c_type_t;
|
||||
typedef const T& c_ref_t;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct traits<T&> {
|
||||
enum {
|
||||
REF = true,
|
||||
CONST = false
|
||||
};
|
||||
|
||||
typedef T& orig_t;
|
||||
typedef T type_t;
|
||||
typedef T& ref_t;
|
||||
|
||||
typedef T& b_orig_t;
|
||||
typedef T b_type_t;
|
||||
typedef T& b_ref_t;
|
||||
|
||||
typedef const T& c_orig_t;
|
||||
typedef const T c_type_t;
|
||||
typedef const T& c_ref_t;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct traits<const T> {
|
||||
enum {
|
||||
REF = false,
|
||||
CONST = true
|
||||
};
|
||||
|
||||
typedef const T orig_t;
|
||||
typedef const T type_t;
|
||||
typedef const T& ref_t;
|
||||
|
||||
typedef T b_orig_t;
|
||||
typedef T b_type_t;
|
||||
typedef T& b_ref_t;
|
||||
|
||||
typedef const T c_orig_t;
|
||||
typedef const T c_type_t;
|
||||
typedef const T& c_ref_t;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct traits<const T&> {
|
||||
enum {
|
||||
REF = true,
|
||||
CONST = true
|
||||
};
|
||||
|
||||
typedef const T& orig_t;
|
||||
typedef const T type_t;
|
||||
typedef const T& ref_t;
|
||||
|
||||
typedef T& b_orig_t;
|
||||
typedef T b_type_t;
|
||||
typedef T& b_ref_t;
|
||||
|
||||
typedef const T& c_orig_t;
|
||||
typedef const T c_type_t;
|
||||
typedef const T& c_ref_t;
|
||||
};
|
||||
|
||||
// Helper function used to generate an instantated type for typeof
|
||||
// calls.
|
||||
template <typename T>
|
||||
T _makeT();
|
||||
|
||||
template <typename Ftor1, typename Ftor2>
|
||||
struct _op_assign;
|
||||
|
||||
// This class acts like a wrapper identifying classes that
|
||||
// are compatible with the algo structure.
|
||||
template <typename Ftor>
|
||||
struct _wrapper {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef typeof(_makeT<Ftor>()(_makeT<Arg0>())) return_t;
|
||||
};
|
||||
|
||||
_wrapper(Ftor ftor) : m_ftor(ftor) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0 = _nil()) {
|
||||
return m_ftor(arg0);
|
||||
}
|
||||
|
||||
// template <typename Arg0>
|
||||
// typename _<Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
// return m_ftor(arg0);
|
||||
// }
|
||||
|
||||
template <typename Ftor2>
|
||||
inline _wrapper<_op_assign<Ftor, Ftor2> >
|
||||
operator = (_wrapper<Ftor2> w) {
|
||||
return make_wrapper(_op_assign<Ftor, Ftor2>(m_ftor, w.m_ftor));
|
||||
}
|
||||
|
||||
Ftor m_ftor;
|
||||
};
|
||||
|
||||
template <typename Ftor>
|
||||
inline _wrapper<Ftor>
|
||||
make_wrapper(Ftor ftor) {
|
||||
return _wrapper<Ftor>(ftor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,314 @@
|
||||
// -*- c++ -*-
|
||||
/* Do not edit! -- generated file */
|
||||
|
||||
#ifndef ALGO_BITS_IMPL_CALL_H
|
||||
#define ALGO_BITS_IMPL_CALL_H
|
||||
|
||||
namespace algo {
|
||||
|
||||
template <typename Func, typename Ret>
|
||||
struct _ptr_fun0 {
|
||||
|
||||
template <typename Arg0, bool r = traits<Ret>::REF>
|
||||
struct _ {
|
||||
typedef Ret return_t;
|
||||
};
|
||||
|
||||
template <typename Arg0>
|
||||
struct _<Arg0, false> {
|
||||
typedef const Ret return_t;
|
||||
};
|
||||
|
||||
_ptr_fun0(Func func) :
|
||||
m_func(func) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return m_func();
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return m_func();
|
||||
}
|
||||
|
||||
Func m_func;
|
||||
|
||||
};
|
||||
|
||||
template <typename Func, typename Ret, typename Parm1>
|
||||
struct _ptr_fun1 {
|
||||
|
||||
template <typename Arg0, bool r = traits<Ret>::REF>
|
||||
struct _ {
|
||||
typedef Ret return_t;
|
||||
};
|
||||
|
||||
template <typename Arg0>
|
||||
struct _<Arg0, false> {
|
||||
typedef const Ret return_t;
|
||||
};
|
||||
|
||||
_ptr_fun1(Func func, Parm1 parm1) :
|
||||
m_func(func), m_parm1(parm1) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return m_func(m_parm1(arg0));
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return m_func(m_parm1(arg0));
|
||||
}
|
||||
|
||||
Func m_func;
|
||||
|
||||
Parm1 m_parm1;
|
||||
};
|
||||
|
||||
template <typename Func, typename Ret, typename Parm1,typename Parm2>
|
||||
struct _ptr_fun2 {
|
||||
|
||||
template <typename Arg0, bool r = traits<Ret>::REF>
|
||||
struct _ {
|
||||
typedef Ret return_t;
|
||||
};
|
||||
|
||||
template <typename Arg0>
|
||||
struct _<Arg0, false> {
|
||||
typedef const Ret return_t;
|
||||
};
|
||||
|
||||
_ptr_fun2(Func func, Parm1 parm1,Parm2 parm2) :
|
||||
m_func(func), m_parm1(parm1),m_parm2(parm2) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return m_func(m_parm1(arg0),m_parm2(arg0));
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return m_func(m_parm1(arg0),m_parm2(arg0));
|
||||
}
|
||||
|
||||
Func m_func;
|
||||
|
||||
Parm1 m_parm1;
|
||||
Parm2 m_parm2;
|
||||
};
|
||||
|
||||
template <typename Func, typename Ret, typename Parm1,typename Parm2,typename Parm3>
|
||||
struct _ptr_fun3 {
|
||||
|
||||
template <typename Arg0, bool r = traits<Ret>::REF>
|
||||
struct _ {
|
||||
typedef Ret return_t;
|
||||
};
|
||||
|
||||
template <typename Arg0>
|
||||
struct _<Arg0, false> {
|
||||
typedef const Ret return_t;
|
||||
};
|
||||
|
||||
_ptr_fun3(Func func, Parm1 parm1,Parm2 parm2,Parm3 parm3) :
|
||||
m_func(func), m_parm1(parm1),m_parm2(parm2),m_parm3(parm3) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return m_func(m_parm1(arg0),m_parm2(arg0),m_parm3(arg0));
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return m_func(m_parm1(arg0),m_parm2(arg0),m_parm3(arg0));
|
||||
}
|
||||
|
||||
Func m_func;
|
||||
|
||||
Parm1 m_parm1;
|
||||
Parm2 m_parm2;
|
||||
Parm3 m_parm3;
|
||||
};
|
||||
|
||||
template <typename Func, typename Ret, typename Parm1,typename Parm2,typename Parm3,typename Parm4>
|
||||
struct _ptr_fun4 {
|
||||
|
||||
template <typename Arg0, bool r = traits<Ret>::REF>
|
||||
struct _ {
|
||||
typedef Ret return_t;
|
||||
};
|
||||
|
||||
template <typename Arg0>
|
||||
struct _<Arg0, false> {
|
||||
typedef const Ret return_t;
|
||||
};
|
||||
|
||||
_ptr_fun4(Func func, Parm1 parm1,Parm2 parm2,Parm3 parm3,Parm4 parm4) :
|
||||
m_func(func), m_parm1(parm1),m_parm2(parm2),m_parm3(parm3),m_parm4(parm4) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return m_func(m_parm1(arg0),m_parm2(arg0),m_parm3(arg0),m_parm4(arg0));
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return m_func(m_parm1(arg0),m_parm2(arg0),m_parm3(arg0),m_parm4(arg0));
|
||||
}
|
||||
|
||||
Func m_func;
|
||||
|
||||
Parm1 m_parm1;
|
||||
Parm2 m_parm2;
|
||||
Parm3 m_parm3;
|
||||
Parm4 m_parm4;
|
||||
};
|
||||
|
||||
|
||||
template <typename Target, typename Func, typename Ret>
|
||||
struct _mem_fun0 {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef Ret return_t;
|
||||
};
|
||||
|
||||
_mem_fun0(Target target, Func func) :
|
||||
m_target(target), m_func(func) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return (m_target(arg0).*m_func)();
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return (m_target(arg0).*m_func)();
|
||||
}
|
||||
|
||||
Target m_target;
|
||||
Func m_func;
|
||||
|
||||
};
|
||||
|
||||
template <typename Target, typename Func, typename Ret, typename Parm1>
|
||||
struct _mem_fun1 {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef Ret return_t;
|
||||
};
|
||||
|
||||
_mem_fun1(Target target, Func func, Parm1 parm1) :
|
||||
m_target(target), m_func(func), m_parm1(parm1) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return (m_target(arg0).*m_func)(m_parm1(arg0));
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return (m_target(arg0).*m_func)(m_parm1(arg0));
|
||||
}
|
||||
|
||||
Target m_target;
|
||||
Func m_func;
|
||||
|
||||
Parm1 m_parm1;
|
||||
};
|
||||
|
||||
template <typename Target, typename Func, typename Ret, typename Parm1,typename Parm2>
|
||||
struct _mem_fun2 {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef Ret return_t;
|
||||
};
|
||||
|
||||
_mem_fun2(Target target, Func func, Parm1 parm1,Parm2 parm2) :
|
||||
m_target(target), m_func(func), m_parm1(parm1),m_parm2(parm2) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return (m_target(arg0).*m_func)(m_parm1(arg0),m_parm2(arg0));
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return (m_target(arg0).*m_func)(m_parm1(arg0),m_parm2(arg0));
|
||||
}
|
||||
|
||||
Target m_target;
|
||||
Func m_func;
|
||||
|
||||
Parm1 m_parm1;
|
||||
Parm2 m_parm2;
|
||||
};
|
||||
|
||||
template <typename Target, typename Func, typename Ret, typename Parm1,typename Parm2,typename Parm3>
|
||||
struct _mem_fun3 {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef Ret return_t;
|
||||
};
|
||||
|
||||
_mem_fun3(Target target, Func func, Parm1 parm1,Parm2 parm2,Parm3 parm3) :
|
||||
m_target(target), m_func(func), m_parm1(parm1),m_parm2(parm2),m_parm3(parm3) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return (m_target(arg0).*m_func)(m_parm1(arg0),m_parm2(arg0),m_parm3(arg0));
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return (m_target(arg0).*m_func)(m_parm1(arg0),m_parm2(arg0),m_parm3(arg0));
|
||||
}
|
||||
|
||||
Target m_target;
|
||||
Func m_func;
|
||||
|
||||
Parm1 m_parm1;
|
||||
Parm2 m_parm2;
|
||||
Parm3 m_parm3;
|
||||
};
|
||||
|
||||
template <typename Target, typename Func, typename Ret, typename Parm1,typename Parm2,typename Parm3,typename Parm4>
|
||||
struct _mem_fun4 {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef Ret return_t;
|
||||
};
|
||||
|
||||
_mem_fun4(Target target, Func func, Parm1 parm1,Parm2 parm2,Parm3 parm3,Parm4 parm4) :
|
||||
m_target(target), m_func(func), m_parm1(parm1),m_parm2(parm2),m_parm3(parm3),m_parm4(parm4) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return (m_target(arg0).*m_func)(m_parm1(arg0),m_parm2(arg0),m_parm3(arg0),m_parm4(arg0));
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return (m_target(arg0).*m_func)(m_parm1(arg0),m_parm2(arg0),m_parm3(arg0),m_parm4(arg0));
|
||||
}
|
||||
|
||||
Target m_target;
|
||||
Func m_func;
|
||||
|
||||
Parm1 m_parm1;
|
||||
Parm2 m_parm2;
|
||||
Parm3 m_parm3;
|
||||
Parm4 m_parm4;
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,102 @@
|
||||
#ifndef ALGO_BITS_IMPL_ENTRY_H
|
||||
#define ALGO_BITS_IMPL_ENTRY_H
|
||||
|
||||
namespace algo {
|
||||
|
||||
template <typename Type>
|
||||
struct _entry {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef Type return_t;
|
||||
};
|
||||
|
||||
_entry(Type t) : m_t(t) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return m_t;
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return m_t;
|
||||
}
|
||||
|
||||
Type m_t;
|
||||
};
|
||||
|
||||
template <typename Target, typename Type, typename Class>
|
||||
struct _member {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef typename traits<Type>::ref_t return_t;
|
||||
};
|
||||
|
||||
_member(Target target, Type Class::*member) :
|
||||
m_target(target), m_member(member) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return (m_target(arg0)).*m_member;
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return (m_target(arg0)).*m_member;
|
||||
}
|
||||
|
||||
Target m_target;
|
||||
Type Class::*m_member;
|
||||
};
|
||||
|
||||
struct _arg0 {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef typename traits<Arg0>::ref_t return_t;
|
||||
};
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return arg0;
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return arg0;
|
||||
}
|
||||
};
|
||||
|
||||
// Consider implementing _on0 and _on2 as m4 macros, but there will
|
||||
// never be more than 0-2, so dunno.
|
||||
template <typename Target, typename Parm0>
|
||||
struct _on1 {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef typeof(_makeT<Target>()(_makeT<Arg0>())) return_t;
|
||||
};
|
||||
|
||||
_on1(Target target, Parm0 parm0) :
|
||||
m_target(target), m_parm0(parm0) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0>::return_t operator () (Arg0& arg0) {
|
||||
return m_target(m_parm0(arg0));
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0>::return_t operator () (const Arg0& arg0) {
|
||||
return m_target(m_parm0(arg0));
|
||||
}
|
||||
|
||||
Target m_target;
|
||||
Parm0 m_parm0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
#ifndef ALGO_BITS_IMPL_LAMBDA_H
|
||||
#define ALGO_BITS_IMPL_LAMBDA_H
|
||||
|
||||
#define ALGO_OP_BINARY( NAME, OP ) \
|
||||
template <typename Ftor1, typename Ftor2> \
|
||||
struct _op_##NAME { \
|
||||
\
|
||||
template <typename Arg0> \
|
||||
struct _ { \
|
||||
typedef typename tmpl_if<traits<Arg0>::REF && !traits<Arg0>::CONST, \
|
||||
Arg0, typename traits<Arg0>::b_ref_t>::result Type; \
|
||||
\
|
||||
typedef typeof(_makeT<Ftor1>()(_makeT<Type>()) OP \
|
||||
_makeT<Ftor2>()(_makeT<Type>())) return_t; \
|
||||
}; \
|
||||
\
|
||||
_op_##NAME(Ftor1 ftor1, Ftor2 ftor2) : m_ftor1(ftor1), m_ftor2(ftor2) {} \
|
||||
\
|
||||
template <typename Arg0> \
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) { \
|
||||
return m_ftor1(arg0) OP m_ftor2(arg0); \
|
||||
} \
|
||||
\
|
||||
template <typename Arg0> \
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) { \
|
||||
return m_ftor1(arg0) OP m_ftor2(arg0); \
|
||||
} \
|
||||
\
|
||||
Ftor1 m_ftor1; \
|
||||
Ftor2 m_ftor2; \
|
||||
};
|
||||
|
||||
#define ALGO_MK_BINARY( NAME, OP ) \
|
||||
template <typename Ftor1, typename Ftor2> \
|
||||
inline _wrapper<_op_##NAME<Ftor1, Ftor2> > \
|
||||
operator OP (_wrapper<Ftor1> w1, _wrapper<Ftor2> w2) { \
|
||||
return make_wrapper(_op_##NAME<Ftor1, Ftor2>(w1.m_ftor, w2.m_ftor)); \
|
||||
}
|
||||
|
||||
#define ALGO_OP_UNARY( NAME, OP ) \
|
||||
template <typename Ftor1> \
|
||||
struct _op_##NAME { \
|
||||
\
|
||||
template <typename Arg0> \
|
||||
struct _ { \
|
||||
typedef typename tmpl_if<traits<Arg0>::REF && !traits<Arg0>::CONST, \
|
||||
Arg0, typename traits<Arg0>::b_ref_t>::result Type; \
|
||||
\
|
||||
typedef typeof( OP _makeT<Ftor1>()(_makeT<Type>()) ) return_t; \
|
||||
}; \
|
||||
\
|
||||
_op_##NAME(Ftor1 ftor1) : m_ftor1(ftor1) {} \
|
||||
\
|
||||
template <typename Arg0> \
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) { \
|
||||
return OP m_ftor1(arg0); \
|
||||
} \
|
||||
\
|
||||
template <typename Arg0> \
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) { \
|
||||
return OP m_ftor1(arg0); \
|
||||
} \
|
||||
\
|
||||
Ftor1 m_ftor1; \
|
||||
}; \
|
||||
\
|
||||
template <typename Ftor1> \
|
||||
inline _wrapper<_op_##NAME<Ftor1> > \
|
||||
operator OP (_wrapper<Ftor1> w1) { \
|
||||
return make_wrapper(_op_##NAME<Ftor1>(w1.m_ftor)); \
|
||||
}
|
||||
|
||||
namespace algo {
|
||||
|
||||
template <typename Ftor, typename Ret>
|
||||
struct op_cast {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef Ret return_t;
|
||||
};
|
||||
|
||||
op_cast(Ftor ftor) : m_ftor(ftor) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return m_ftor(arg0);
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return m_ftor(arg0);
|
||||
}
|
||||
|
||||
Ftor m_ftor;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,156 @@
|
||||
// -*- c++ -*-
|
||||
/* Do not edit! -- generated file */
|
||||
|
||||
#ifndef ALGO_BITS_IMPL_MEMORY_H
|
||||
#define ALGO_BITS_IMPL_MEMORY_H
|
||||
|
||||
namespace algo {
|
||||
|
||||
template <typename Ftor>
|
||||
struct _delete {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef void return_t;
|
||||
};
|
||||
|
||||
_delete(Ftor ftor) : m_ftor(ftor) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
delete m_ftor(arg0);
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
delete m_ftor(arg0);
|
||||
}
|
||||
|
||||
Ftor m_ftor;
|
||||
};
|
||||
|
||||
template <typename Type>
|
||||
struct _new0 {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef Type* return_t;
|
||||
};
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return new Type;
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return new Type;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Type, typename P1>
|
||||
struct _new1 {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef Type* return_t;
|
||||
};
|
||||
|
||||
_new1(P1 p1) :
|
||||
m_p1(p1) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return new Type(m_p1(arg0));
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return new Type(m_p1(arg0));
|
||||
}
|
||||
|
||||
P1 m_p1;
|
||||
};
|
||||
|
||||
template <typename Type, typename P1,typename P2>
|
||||
struct _new2 {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef Type* return_t;
|
||||
};
|
||||
|
||||
_new2(P1 p1,P2 p2) :
|
||||
m_p1(p1),m_p2(p2) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return new Type(m_p1(arg0),m_p2(arg0));
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return new Type(m_p1(arg0),m_p2(arg0));
|
||||
}
|
||||
|
||||
P1 m_p1;
|
||||
P2 m_p2;
|
||||
};
|
||||
|
||||
template <typename Type, typename P1,typename P2,typename P3>
|
||||
struct _new3 {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef Type* return_t;
|
||||
};
|
||||
|
||||
_new3(P1 p1,P2 p2,P3 p3) :
|
||||
m_p1(p1),m_p2(p2),m_p3(p3) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return new Type(m_p1(arg0),m_p2(arg0),m_p3(arg0));
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return new Type(m_p1(arg0),m_p2(arg0),m_p3(arg0));
|
||||
}
|
||||
|
||||
P1 m_p1;
|
||||
P2 m_p2;
|
||||
P3 m_p3;
|
||||
};
|
||||
|
||||
template <typename Type, typename P1,typename P2,typename P3,typename P4>
|
||||
struct _new4 {
|
||||
|
||||
template <typename Arg0>
|
||||
struct _ {
|
||||
typedef Type* return_t;
|
||||
};
|
||||
|
||||
_new4(P1 p1,P2 p2,P3 p3,P4 p4) :
|
||||
m_p1(p1),m_p2(p2),m_p3(p3),m_p4(p4) {}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<Arg0&>::return_t operator () (Arg0& arg0) {
|
||||
return new Type(m_p1(arg0),m_p2(arg0),m_p3(arg0),m_p4(arg0));
|
||||
}
|
||||
|
||||
template <typename Arg0>
|
||||
typename _<const Arg0&>::return_t operator () (const Arg0& arg0) {
|
||||
return new Type(m_p1(arg0),m_p2(arg0),m_p3(arg0),m_p4(arg0));
|
||||
}
|
||||
|
||||
P1 m_p1;
|
||||
P2 m_p2;
|
||||
P3 m_p3;
|
||||
P4 m_p4;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user