vectorwrapper/include/vectorwrapper/sequence_bt.hpp

59 lines
1.6 KiB
C++
Raw Permalink Normal View History

2015-07-22 23:37:35 +00:00
/*
2020-05-04 01:59:02 +00:00
* Copyright 2015-2020 Michele "King_DuckZ" Santullo
2015-07-22 23:37:35 +00:00
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
2015-07-22 23:37:35 +00:00
#include <cstddef>
#if defined VWR_OUTER_NAMESPACE
namespace VWR_OUTER_NAMESPACE {
#endif
2015-07-22 23:37:35 +00:00
namespace vwr {
namespace bt {
2016-11-02 02:37:01 +00:00
template <typename T, T... I>
struct number_seq {
2015-07-22 23:37:35 +00:00
};
2016-11-02 02:37:01 +00:00
template <std::size_t... I>
using index_seq = number_seq<std::size_t, I...>;
2015-07-22 23:37:35 +00:00
namespace implem {
2016-11-02 02:37:01 +00:00
template <typename T, T MIN, T MAX, T... I>
2015-07-22 23:37:35 +00:00
struct range_builder;
2016-11-02 02:37:01 +00:00
template <typename T, T MIN, T... I>
struct range_builder<T, MIN, MIN, I...> {
typedef number_seq<T, I...> type;
2015-07-22 23:37:35 +00:00
};
2016-11-02 02:37:01 +00:00
template <typename T, T MIN, T N, T... I>
struct range_builder : public range_builder<T, MIN, N - 1, N - 1, I...> {
2015-07-22 23:37:35 +00:00
};
} //namespace implem
2016-11-02 02:37:01 +00:00
template <typename T, T MIN, T MAX>
using number_range = typename implem::range_builder<T, MIN, MAX>::type;
2015-07-22 23:37:35 +00:00
template <std::size_t MIN, std::size_t MAX>
2016-11-02 02:37:01 +00:00
using index_range = number_range<std::size_t, MIN, MAX>;
2015-07-22 23:37:35 +00:00
} //namespace bt
} //namespace vwr
#if defined VWR_OUTER_NAMESPACE
} //namespace VWR_OUTER_NAMESPACE
#endif