From faeacdcfbfcfcf0804d64d839eb5ee14a5d84c35 Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Sat, 7 Aug 2021 00:07:23 +0200 Subject: [PATCH] Added makearray --- CMakeLists.txt | 1 + cpputils_src.pri | 5 +++++ src/makearray.h | 30 ++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 src/makearray.h diff --git a/CMakeLists.txt b/CMakeLists.txt index c5da54b..bb01a1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ set(headers src/cpputils.h src/crc32builder.h src/delayedconstruction.h + src/makearray.h src/numberparsing.h src/refwhenneeded.h src/strutils.h diff --git a/cpputils_src.pri b/cpputils_src.pri index 2f77f6f..9e7e1ee 100644 --- a/cpputils_src.pri +++ b/cpputils_src.pri @@ -1,5 +1,6 @@ HEADERS += \ $$PWD/src/cleanuphelper.h \ + $$PWD/src/color_utils.h \ $$PWD/src/cppbitmask.h \ $$PWD/src/cppflags.h \ $$PWD/src/cppmacros.h \ @@ -7,9 +8,13 @@ HEADERS += \ $$PWD/src/cppsignal.h \ $$PWD/src/cpptypesafeenum.h \ $$PWD/src/cpputils.h \ + $$PWD/src/crc32builder.h \ $$PWD/src/delayedconstruction.h \ + $$PWD/src/makearray.h \ + $$PWD/src/numberparsing.h \ $$PWD/src/refwhenneeded.h \ $$PWD/src/strutils.h SOURCES += \ + $$PWD/src/color_utils.cpp \ $$PWD/src/strutils.cpp diff --git a/src/makearray.h b/src/makearray.h new file mode 100644 index 0000000..30305a2 --- /dev/null +++ b/src/makearray.h @@ -0,0 +1,30 @@ +#pragma once + +// system includes +#include + +namespace goe { +namespace details { + template struct is_ref_wrapper : std::false_type {}; + template struct is_ref_wrapper> : std::true_type {}; + + template + using not_ref_wrapper = std::negation>>; + + template struct return_type_helper { using type = D; }; + template + struct return_type_helper : std::common_type { + //static_assert(std::conjunction_v...>, + // "Types cannot contain reference_wrappers when D is void"); + }; + + template + using return_type = std::array::type, + sizeof...(Types)>; +} // namespace details + +template < class D = void, class... Types> +constexpr details::return_type make_array(Types&&... t) { + return {std::forward(t)... }; +} +} // namespace goe