From 69273cbf5c4380ac2dd5968c3084554a8b6ec4f1 Mon Sep 17 00:00:00 2001 From: Jonah Miller Date: Fri, 13 Oct 2023 16:05:17 -0600 Subject: [PATCH 01/20] Add Modify functionality. Still debugging. --- singularity-eos/base/variadic_utils.hpp | 28 ++++++- singularity-eos/eos/eos.hpp | 16 ++-- singularity-eos/eos/eos_builder.hpp | 107 +++++++++++++++++++++++- test/compare_on_data.cpp | 7 +- test/test_eos_modifiers.cpp | 39 +++++---- 5 files changed, 162 insertions(+), 35 deletions(-) diff --git a/singularity-eos/base/variadic_utils.hpp b/singularity-eos/base/variadic_utils.hpp index 2d1aa9f7de..2099f3e4b4 100644 --- a/singularity-eos/base/variadic_utils.hpp +++ b/singularity-eos/base/variadic_utils.hpp @@ -18,7 +18,31 @@ #include namespace singularity { -namespace detail { +namespace types { + +// Some generic variatic utilities +// ====================================================================== + +// Backport of C++17 bool_constant. +// With C++17, can be replaced with +// using std::bool_constant +template +using bool_constant = std::integral_constant; + +// Implementation of std::conjunction/std::disjunction without C++17 +// With C++17, can be replaced with +// using std::disjunction +template struct bool_pack{}; +template +using conjunction = std::is_same, bool_pack>; +template +struct disjunction : bool_constant::value>{}; + +// Checks if T is contained in the pack Ts +template +constexpr bool contains_v(){ + return disjunction::value...>::value; +} // variadic list template @@ -156,7 +180,7 @@ constexpr auto pack_size(type_list) { return sizeof...(Ts); } -} // namespace detail +} // namespace types } // namespace singularity #endif // SINGULARITY_EOS_BASE_VARIADIC_UTILS_HPP_ diff --git a/singularity-eos/eos/eos.hpp b/singularity-eos/eos/eos.hpp index 82dc1743d8..81b692fa96 100644 --- a/singularity-eos/eos/eos.hpp +++ b/singularity-eos/eos/eos.hpp @@ -57,13 +57,13 @@ namespace singularity { // recreate variadic list template -using tl = singularity::detail::type_list; +using tl = singularity::types::type_list; template