ALPSCore reference
has_value_type.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1998-2018 ALPS Collaboration. See COPYRIGHT.TXT
3  * All rights reserved. Use is subject to license terms. See LICENSE.TXT
4  * For use in publications, see ACKNOWLEDGE.TXT
5  */
6 
7 /* $Id: obsvalue.h 3435 2009-11-28 14:45:38Z troyer $ */
8 
9 #ifndef ALPS_TYPE_TRAITS_HAS_VALUE_TYPE_H
10 #define ALPS_TYPE_TRAITS_HAS_VALUE_TYPE_H
11 
12 #include <type_traits>
13 
14 namespace alps {
15 
16 template<typename T> struct has_value_type {
17  template<typename U> static char check(typename U::value_type *);
18  template<typename U> static double check(...);
19  typedef std::integral_constant<bool, sizeof(char) == sizeof(check<T>(0))> type;
20  constexpr static bool value = type::value;
21 };
22 
23 } // end namespace alps
24 
25 #endif // ALPS_TYPE_TRAITS_HAS_VALUE_TYPE_H
static constexpr bool value
static char check(typename U::value_type *)
std::integral_constant< bool, sizeof(char)==sizeof(check< T >0))> type