/* { dg-do compile } */
|
/* { dg-do compile } */
|
/* { dg-options "-O2" } */
|
/* { dg-options "-O2" } */
|
namespace sigc {
|
namespace sigc {
|
template struct type_trait {
|
template struct type_trait {
|
typedef T_type& pass;
|
typedef T_type& pass;
|
typedef const T_type& take;
|
typedef const T_type& take;
|
typedef T_type* pointer;
|
typedef T_type* pointer;
|
};
|
};
|
template struct type_trait {
|
template struct type_trait {
|
typedef T_type& pass;
|
typedef T_type& pass;
|
};
|
};
|
template<> struct type_trait {
|
template<> struct type_trait {
|
typedef void pass;
|
typedef void pass;
|
};
|
};
|
template struct is_base_and_derived {
|
template struct is_base_and_derived {
|
struct big {
|
struct big {
|
char memory[64];
|
char memory[64];
|
};
|
};
|
static big is_base_class_(...);
|
static big is_base_class_(...);
|
static char is_base_class_(typename type_trait::pointer);
|
static char is_base_class_(typename type_trait::pointer);
|
static const bool value = sizeof(is_base_class_(reinterpret_cast::pointer>(0))) == sizeof(char);
|
static const bool value = sizeof(is_base_class_(reinterpret_cast::pointer>(0))) == sizeof(char);
|
};
|
};
|
struct nil;
|
struct nil;
|
struct functor_base {
|
struct functor_base {
|
};
|
};
|
template ::value> struct functor_trait {
|
template ::value> struct functor_trait {
|
typedef typename T_functor::result_type result_type;
|
typedef typename T_functor::result_type result_type;
|
typedef T_functor functor_type;
|
typedef T_functor functor_type;
|
};
|
};
|
struct adaptor_base : public functor_base {
|
struct adaptor_base : public functor_base {
|
};
|
};
|
template ::value> struct deduce_result_type {
|
template ::value> struct deduce_result_type {
|
typedef typename functor_trait::result_type type;
|
typedef typename functor_trait::result_type type;
|
};
|
};
|
template struct adaptor_functor
|
template struct adaptor_functor
|
: public adaptor_base {
|
: public adaptor_base {
|
template struct deduce_result_type {
|
template struct deduce_result_type {
|
typedef typename sigc::deduce_result_type::type type;
|
typedef typename sigc::deduce_result_type::type type;
|
};
|
};
|
typedef typename functor_trait::result_type result_type;
|
typedef typename functor_trait::result_type result_type;
|
template typename deduce_result_type::type operator()(T_arg1 _A_arg1,T_arg2 _A_arg2) const {
|
template typename deduce_result_type::type operator()(T_arg1 _A_arg1,T_arg2 _A_arg2) const {
|
return functor_(_A_arg1,_A_arg2);
|
return functor_(_A_arg1,_A_arg2);
|
}
|
}
|
explicit adaptor_functor(const T_functor& _A_functor) : functor_(_A_functor) {
|
explicit adaptor_functor(const T_functor& _A_functor) : functor_(_A_functor) {
|
}
|
}
|
mutable T_functor functor_;
|
mutable T_functor functor_;
|
};
|
};
|
template ::value> struct adaptor_trait;
|
template ::value> struct adaptor_trait;
|
template struct adaptor_trait {
|
template struct adaptor_trait {
|
typedef T_functor adaptor_type;
|
typedef T_functor adaptor_type;
|
};
|
};
|
template struct adaptor_trait {
|
template struct adaptor_trait {
|
typedef typename functor_trait::functor_type functor_type;
|
typedef typename functor_trait::functor_type functor_type;
|
typedef adaptor_functor adaptor_type;
|
typedef adaptor_functor adaptor_type;
|
};
|
};
|
template struct adapts
|
template struct adapts
|
: public adaptor_base {
|
: public adaptor_base {
|
typedef typename adaptor_trait::adaptor_type adaptor_type;
|
typedef typename adaptor_trait::adaptor_type adaptor_type;
|
explicit adapts(const T_functor& _A_functor) : functor_(_A_functor) {
|
explicit adapts(const T_functor& _A_functor) : functor_(_A_functor) {
|
}
|
}
|
mutable adaptor_type functor_;
|
mutable adaptor_type functor_;
|
};
|
};
|
template struct unwrap_reference {
|
template struct unwrap_reference {
|
typedef T_type type;
|
typedef T_type type;
|
};
|
};
|
template class bound_argument {
|
template class bound_argument {
|
public:
|
public:
|
bound_argument(const T_type& _A_argument) : visited_(_A_argument) {
|
bound_argument(const T_type& _A_argument) : visited_(_A_argument) {
|
}
|
}
|
inline T_type& invoke() {
|
inline T_type& invoke() {
|
}
|
}
|
T_type visited_;
|
T_type visited_;
|
};
|
};
|
template struct bind_functor;
|
template struct bind_functor;
|
template struct bind_functor<0, T_functor, T_bound, nil,nil,nil,nil,nil,nil> : public adapts {
|
template struct bind_functor<0, T_functor, T_bound, nil,nil,nil,nil,nil,nil> : public adapts {
|
typedef typename adapts::adaptor_type adaptor_type;
|
typedef typename adapts::adaptor_type adaptor_type;
|
template struct deduce_result_type {
|
template struct deduce_result_type {
|
typedef typename adaptor_type::template deduce_result_type::type>::pass, typename type_trait::pass, typename type_trait::pass, typename type_trait::pass, typename type_trait::pass, typename type_trait::pass, typename type_trait::pass>::type type;
|
typedef typename adaptor_type::template deduce_result_type::type>::pass, typename type_trait::pass, typename type_trait::pass, typename type_trait::pass, typename type_trait::pass, typename type_trait::pass, typename type_trait::pass>::type type;
|
};
|
};
|
typedef typename adaptor_type::result_type result_type;
|
typedef typename adaptor_type::result_type result_type;
|
result_type operator()() {
|
result_type operator()() {
|
return this->functor_.template operator()::type>::pass> (bound_.invoke());
|
return this->functor_.template operator()::type>::pass> (bound_.invoke());
|
}
|
}
|
template typename deduce_result_type::type operator()(T_arg1 _A_arg1) {
|
template typename deduce_result_type::type operator()(T_arg1 _A_arg1) {
|
return this->functor_.template operator()::type>::pass, typename type_trait::pass> (bound_.invoke(), _A_arg1);
|
return this->functor_.template operator()::type>::pass, typename type_trait::pass> (bound_.invoke(), _A_arg1);
|
}
|
}
|
bind_functor(typename type_trait::take _A_func, typename type_trait::take _A_bound) : adapts(_A_func), bound_(_A_bound) {
|
bind_functor(typename type_trait::take _A_func, typename type_trait::take _A_bound) : adapts(_A_func), bound_(_A_bound) {
|
}
|
}
|
bound_argument bound_;
|
bound_argument bound_;
|
};
|
};
|
template inline bind_functor bind(const T_functor& _A_func, T_bound1 _A_b1) {
|
template inline bind_functor bind(const T_functor& _A_func, T_bound1 _A_b1) {
|
return bind_functor(_A_func, _A_b1);
|
return bind_functor(_A_func, _A_b1);
|
};
|
};
|
}
|
}
|
struct foo {
|
struct foo {
|
typedef int result_type;
|
typedef int result_type;
|
int operator()(int i, int j);
|
int operator()(int i, int j);
|
};
|
};
|
int main() {
|
int main() {
|
sigc::bind<0>(sigc::bind<0>(foo(),7),8)();
|
sigc::bind<0>(sigc::bind<0>(foo(),7),8)();
|
}
|
}
|
|
|