• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2Copyright 2017 Glen Joseph Fernandes
3(glenjofe@gmail.com)
4
5Distributed under Boost Software License, Version 1.0.
6(See accompanying file LICENSE_1_0.txt or copy at
7http://www.boost.org/LICENSE_1_0.txt)
8*/
9
10// MACRO: BOOST_NO_CXX11_SFINAE_EXPR
11// TITLE: C++11 SFINAE for expressions
12// DESCRIPTION: C++11 SFINAE for expressions not supported.
13
14namespace boost_no_cxx11_sfinae_expr {
15
16template<class>
17struct ignore {
18    typedef void type;
19};
20
21template<class T>
22T& object();
23
24template<class T, class E = void>
25struct trait {
26    static const int value = 0;
27};
28
29template<class T>
30struct trait<T, typename ignore<decltype(&object<T>())>::type> { };
31
32template<class T>
33struct result {
34    static const int value = T::value;
35};
36
37class type {
38    void operator&() const { }
39};
40
41int test()
42{
43    return result<trait<type> >::value;
44}
45
46} /* boost_no_cxx11_sfinae_expr */
47