[ create a new paste ] login | about

Link: http://codepad.org/1op6p2Mc    [ raw code | output | fork ]

C++, pasted on Dec 16:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* 
<URL: file://localhost/usr/share/doc/packages/boost-1.44.0/libs/bind/mem_fn.html#Purpose >

   All function objects returned by mem_fn expose a result_type typedef
   that represents the return type of the member function. For data
   members, result_type is defined as the type of the member.

*/

typedef int type_of_the_member;

struct U { type_of_the_member m; };

template < class F > 
typename F ::result_type U_m (F const &t, U &u) 
{ typedef typename F:: result_type r; typedef type_of_the_member r;
typename F:: result_type r1; return t (u); }

U u; int x ((U_m (::boost ::mem_fn (&U ::m), u)));


Output:
1
2
3
In function 'typename F::result_type U_m(const F&, U&)':
Line 16: error: conflicting declaration 'typedef type_of_the_member r'
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: