language: C++ 4.7.2 (gcc-4.7.2)
date: 367 days 23 hours ago
link:
visibility: public
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
#include <cassert>
 
template <class T>
void foo()
{
}
 
/** Determine whether the 'foo' attribute of an object is negative. */
template <class T>
bool foo_negative(T& v)
{
    return 0>v.foo;
}
 
struct X
{
    int foo;
};
 
int main()
{
    X x;
    x.foo = 5;
    assert(!foo_negative(x));
    return 0;
}