blob: 8230b94e5b93ec0a7ee67edc37edf3e1c9c53f9c (
plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
|
// PR c++/17132
template <typename T>
struct has_deref
{
struct impl
{
template <
typename Type,
typename Type::reference (Type::*Func)(void) const>
struct func_tag;
template <typename Type>
static char (& test(
Type *,
func_tag<Type, &Type::operator*> * = 0
))[2];
static char test(void *);
};
static const bool value = (sizeof(impl::test((T *) 0)) == 2);
};
template <typename T>
struct container
{
struct iterator
{
typedef T & reference;
reference operator*() const;
};
};
int main()
{
typedef container<int>::iterator iter;
int result = has_deref<iter>::value;
return result;
}
|