variadic: add index helper type
This commit is contained in:
parent
1be5be38ea
commit
f9e8ea78bf
@ -186,6 +186,9 @@ UTIL_FILES = \
|
||||
types/traits.hpp \
|
||||
uri.hpp \
|
||||
uri.cpp \
|
||||
variadic.cpp \
|
||||
variadic.hpp \
|
||||
variadic.ipp \
|
||||
vector.cpp \
|
||||
vector.hpp \
|
||||
version.cpp \
|
||||
|
19
variadic.cpp
Normal file
19
variadic.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
|
||||
*/
|
||||
|
||||
#include "variadic.hpp"
|
||||
|
||||
// Make sure _someone_ includes the header for syntax checking
|
39
variadic.hpp
Normal file
39
variadic.hpp
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
|
||||
*/
|
||||
|
||||
#ifndef __UTIL_VARIADIC_HPP
|
||||
#define __UTIL_VARIADIC_HPP
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace util {
|
||||
template <size_t ...N>
|
||||
struct indices
|
||||
{
|
||||
typedef indices<N..., sizeof...(N)> next;
|
||||
};
|
||||
|
||||
|
||||
template <size_t N>
|
||||
struct make_indices
|
||||
{
|
||||
typedef typename make_indices<N-1>::type::next type;
|
||||
};
|
||||
}
|
||||
|
||||
#include "variadic.ipp"
|
||||
|
||||
#endif
|
29
variadic.ipp
Normal file
29
variadic.ipp
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* Copyright 2015 Danny Robson <danny@nerdcruft.net>
|
||||
*/
|
||||
|
||||
#ifdef __UTIL_VARIADIC_IPP
|
||||
#error
|
||||
#endif
|
||||
#define __UTIL_VARIADIC_IPP
|
||||
|
||||
|
||||
namespace util {
|
||||
template<>
|
||||
struct make_indices<0>
|
||||
{
|
||||
typedef indices<> type;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user