【C++】template 統合スレ -- STL/Boost/Loki, etc.
■ このスレッドは過去ログ倉庫に格納されています
0787デフォルトの名無しさん
NGNGこんな感じかと
#include <iostream>
#include <functional>
class A
{
public:
int b;
void hoge( int v ){ std::cout << b << v << std::endl; }
public:
template< typename type >
type& operator ->*( type A::*p ){ return this->*p; }
template< typename type >
std::binder1st< std::mem_fun1_t< type, A, int > >
operator ->*( type (A::*p)( int ) ){ return std::bind1st( std::mem_fun1( p ), this ); }
};
int main()
{
A a;
int A::* pb = &A::b;
a->*pb = 10;
void (A::*phoge)( int ) = A::hoge;
(a->*phoge)( 20 );
}
■ このスレッドは過去ログ倉庫に格納されています