| 25 | |
| 26 | template <size_t n, typename... T> |
| 27 | boost::variant<T...> _tuple_index(size_t i, const std::tuple<T...>& tpl) { |
| 28 | if (i == n) |
| 29 | return std::get<n>(tpl); |
| 30 | else if (n == sizeof...(T) - 1) |
| 31 | throw std::out_of_range("越界."); |
| 32 | else |
| 33 | return _tuple_index<(n < sizeof...(T)-1 ? n+1 : 0)>(i, tpl); |
| 34 | } |
| 35 | template <typename... T> |
| 36 | boost::variant<T...> tuple_index(size_t i, const std::tuple<T...>& tpl) { |
| 37 | return _tuple_index<0>(i, tpl); |
nothing calls this directly
no outgoing calls
no test coverage detected