ALPSCore reference
size.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$ */
8 
9 #ifndef ALPS_UTILITY_SIZE_HPP
10 #define ALPS_UTILITY_SIZE_HPP
11 
13 
14 #include <type_traits>
15 
16 namespace alps {
17 
18 template <class T>
19 inline typename std::enable_if<!is_sequence<T>::value,std::size_t>::type
20 size(T const&)
21 {
22  return 1;
23 }
24 
25 template <class T>
26 inline typename std::enable_if<is_sequence<T>::value,std::size_t>::type
27 size(T const& a)
28 {
29  return a.size();
30 }
31 
32 } // end namespace alps
33 
34 #endif // ALPS_UTILITY_SIZE_HPP
std::enable_if<!is_sequence< T >::value, std::size_t >::type size(T const &)
Definition: size.hpp:20