diff --git a/Makefile.am b/Makefile.am index d5a6bfc3..c7cead25 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 \ diff --git a/variadic.cpp b/variadic.cpp new file mode 100644 index 00000000..30b9e4e0 --- /dev/null +++ b/variadic.cpp @@ -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 + */ + +#include "variadic.hpp" + +// Make sure _someone_ includes the header for syntax checking diff --git a/variadic.hpp b/variadic.hpp new file mode 100644 index 00000000..b4f8eb0c --- /dev/null +++ b/variadic.hpp @@ -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 + */ + +#ifndef __UTIL_VARIADIC_HPP +#define __UTIL_VARIADIC_HPP + +#include + +namespace util { + template + struct indices + { + typedef indices next; + }; + + + template + struct make_indices + { + typedef typename make_indices::type::next type; + }; +} + +#include "variadic.ipp" + +#endif diff --git a/variadic.ipp b/variadic.ipp new file mode 100644 index 00000000..931c88a4 --- /dev/null +++ b/variadic.ipp @@ -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 + */ + +#ifdef __UTIL_VARIADIC_IPP +#error +#endif +#define __UTIL_VARIADIC_IPP + + +namespace util { + template<> + struct make_indices<0> + { + typedef indices<> type; + }; +}