framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
variadic_switch_fallthrough.hpp
Go to the documentation of this file.
1 // Copyright (C) 2012 iwg molw5
2 // For conditions of distribution and use, see copyright notice in COPYING
3 
17 #pragma once
18 
19 #ifdef FRAMEWORK_NO_BOOST
20  #error "Not implemented"
21 #endif
22 
23 #include <utility>
24 
25 #include <boost/preprocessor/config/limits.hpp>
26 #include <boost/preprocessor/repetition/repeat.hpp>
27 #include <boost/preprocessor/punctuation/comma_if.hpp>
28 #include <boost/preprocessor/iteration/local.hpp>
29 
32 
33 #ifndef FRAMEWORK_VARIADIC_SWITCH_LIMIT
34  #define FRAMEWORK_VARIADIC_SWITCH_LIMIT 20
35 #else
36  #if FRAMEWORK_VARIADIC_SWITCH_LIMIT > BOOST_PP_LIMIT_REPEAT
37  #error "Variadic switch limit cannot exceed BOOST_PP_LIMIT_REPEAT"
38  #endif
39 #endif
40 
41 #if FRAMEWORK_VARIADIC_SWITCH_LIMIT <= 0
42  #error "Invalid variadic switch limit"
43 #endif
44 
45 namespace framework
46 {
47  namespace detail
48  {
49  template <typename CaseList>
50  struct variadic_switch_fallthrough_impl;
51  }
52 
88  template <typename CaseList, typename Handler, typename Index, typename... Args>
90  void variadic_switch_fallthrough (Handler&& handler, Index&& index, Args&&... args)
91  {
92  detail::variadic_switch_fallthrough_impl <CaseList>::run(
93  std::forward <Handler> (handler),
94  std::forward <Index> (index),
95  std::forward <Args> (args)...);
96  }
97 }
98 
99 #include <framework/common/variadic_switch_fallthrough.inl>