OSVR-Core
Size.h
Go to the documentation of this file.
1 
14 // Copyright 2015 Sensics, Inc.
15 // TypePack is part of OSVR-Core.
16 //
17 // Incorporates code from "meta":
18 // Copyright Eric Niebler 2014-2015
19 //
20 // Use, modification and distribution is subject to the
21 // Boost Software License, Version 1.0. (See accompanying
22 // file LICENSE_1_0.txt or copy at
23 // http://www.boost.org/LICENSE_1_0.txt)
24 //
25 // Project home: https://github.com/ericniebler/meta
26 //
27 
28 #ifndef INCLUDED_Size_h_GUID_138C49DE_2C02_4BA6_C173_58BC95D82363
29 #define INCLUDED_Size_h_GUID_138C49DE_2C02_4BA6_C173_58BC95D82363
30 
31 // Internal Includes
32 #include "CoerceList.h"
33 #include "SizeT.h"
34 
35 // Library/third-party includes
36 // - none
37 
38 // Standard includes
39 // - none
40 namespace osvr {
41 namespace typepack {
42  namespace detail {
43  template <typename... Ts> struct size;
44 
45  // The following fails with clang due to a bug.
46  // <https://llvm.org/bugs/show_bug.cgi?id=14858>
47  // template <typename... Ts> using size_impl =
48  // size_t_<sizeof...(Ts)>;
49  // template <typename... Ts>
50  // struct size<list<Ts...>> : size_impl<Ts...> {};
51  template <typename... Ts>
52  struct size<list<Ts...>> : size_t_<sizeof...(Ts)> {};
53  } // namespace detail
54 
56  template <typename... Ts> using size = detail::size<coerce_list<Ts...>>;
57 
59  template <typename... Ts> using length = size<coerce_list<Ts...>>;
60 
61 } // namespace typepack
62 } // namespace osvr
63 #endif // INCLUDED_Size_h_GUID_138C49DE_2C02_4BA6_C173_58BC95D82363
The main namespace for all C++ elements of the framework, internal and external.
Definition: namespace_osvr.dox:3
Header.
A wrapper for a template parameter pack of types.
Definition: List.h:52
Definition: newuoa.h:1888
Definition: Size.h:43
std::integral_constant< std::size_t, V > size_t_
Alias template to simplify creating an integral constant of size_t.
Definition: SizeT.h:46
Header.
t_< list< Ts... >> coerce_list
Will turn whatever is passed into it into the simplest list.
Definition: CoerceList.h:36