diff options
author | Adrian Kummerlaender | 2015-02-19 21:07:57 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-02-19 21:07:57 +0100 |
commit | 397264a5e0046d9c84d8de41b9683ae695c516e0 (patch) | |
tree | bebe4e2438e1ee26a25fb3861fd3aed12768096e /src | |
parent | a07999f7436802f15fc21bebd083006c9e681638 (diff) | |
download | TypeAsValue-397264a5e0046d9c84d8de41b9683ae695c516e0.tar TypeAsValue-397264a5e0046d9c84d8de41b9683ae695c516e0.tar.gz TypeAsValue-397264a5e0046d9c84d8de41b9683ae695c516e0.tar.bz2 TypeAsValue-397264a5e0046d9c84d8de41b9683ae695c516e0.tar.lz TypeAsValue-397264a5e0046d9c84d8de41b9683ae695c516e0.tar.xz TypeAsValue-397264a5e0046d9c84d8de41b9683ae695c516e0.tar.zst TypeAsValue-397264a5e0046d9c84d8de41b9683ae695c516e0.zip |
Moved `Apply`'s placeholder into separate detail header
* separate actual `Apply` specializations in `detail/apply.h` from placeholder details
Diffstat (limited to 'src')
-rw-r--r-- | src/function/detail/apply.h | 32 | ||||
-rw-r--r-- | src/function/detail/placeholder.h | 42 |
2 files changed, 45 insertions, 29 deletions
diff --git a/src/function/detail/apply.h b/src/function/detail/apply.h index aca0af4..2f4c782 100644 --- a/src/function/detail/apply.h +++ b/src/function/detail/apply.h @@ -1,38 +1,11 @@ #ifndef TYPEASVALUE_SRC_FUNCTION_DETAIL_APPLY_H_ #define TYPEASVALUE_SRC_FUNCTION_DETAIL_APPLY_H_ -#include <type_traits> - -#include "list/list.h" -#include "list/operation/nth.h" -#include "list/operation/higher/query.h" +#include "placeholder.h" namespace tav { -namespace detail { - -struct placeholder_tag { }; - -template <typename Type> -using is_placeholder = Eval<std::is_base_of<placeholder_tag, Type>>; - -template <int Index> -struct placeholder : placeholder_tag { }; - -template <typename, typename Argument> -struct resolve_placeholder { - typedef Argument type; -}; -template < - typename Partials, - int Index -> -struct resolve_placeholder<Partials, placeholder<Index>> { - typedef Nth<Size<Index>, Partials> type; -}; - -template <typename... Arguments> -using count_placeholders = Count<is_placeholder, List<Arguments...>>; +namespace detail { template < template<typename...> class Function, @@ -81,6 +54,7 @@ struct apply_pair : apply_variadic<Function, Arguments...> { }; } + } #endif // TYPEASVALUE_SRC_FUNCTION_DETAIL_APPLY_H_ diff --git a/src/function/detail/placeholder.h b/src/function/detail/placeholder.h new file mode 100644 index 0000000..8105de5 --- /dev/null +++ b/src/function/detail/placeholder.h @@ -0,0 +1,42 @@ +#ifndef TYPEASVALUE_SRC_FUNCTION_DETAIL_PLACEHOLDER_H_ +#define TYPEASVALUE_SRC_FUNCTION_DETAIL_PLACEHOLDER_H_ + +#include <type_traits> + +#include "list/list.h" +#include "list/operation/nth.h" +#include "list/operation/higher/query.h" + +namespace tav { + +namespace detail { + +struct placeholder_tag { }; + +template <int Index> +struct placeholder : placeholder_tag { }; + +template <typename Type> +using is_placeholder = Eval<std::is_base_of<placeholder_tag, Type>>; + +template <typename... Arguments> +using count_placeholders = Count<is_placeholder, List<Arguments...>>; + +template <typename, typename Argument> +struct resolve_placeholder { + typedef Argument type; +}; + +template < + typename Partials, + int Index +> +struct resolve_placeholder<Partials, placeholder<Index>> { + typedef Nth<Size<Index>, Partials> type; +}; + +} + +} + +#endif // TYPEASVALUE_SRC_FUNCTION_DETAIL_PLACEHOLDER_H_ |