diff --git a/benchmark/JoinAlgorithmBenchmark.cpp b/benchmark/JoinAlgorithmBenchmark.cpp index 3085ed9301..735229b976 100644 --- a/benchmark/JoinAlgorithmBenchmark.cpp +++ b/benchmark/JoinAlgorithmBenchmark.cpp @@ -1329,7 +1329,7 @@ class GeneralInterfaceImplementation : public BenchmarkInterface { bool addNewRowToBenchmarkTable( ResultTable* table, const QL_OPT_CONCEPT( - (ad_utility::SameAsAny)) auto changingParameterValue, + ad_utility::SameAsAny) auto changingParameterValue, ad_utility::InvocableWithExactReturnType auto stopFunction, diff --git a/benchmark/infrastructure/Benchmark.h b/benchmark/infrastructure/Benchmark.h index 60c28d86b4..569fb226da 100644 --- a/benchmark/infrastructure/Benchmark.h +++ b/benchmark/infrastructure/Benchmark.h @@ -69,7 +69,7 @@ class BenchmarkResults { that the new `CopyableUniquePtr` will own. */ template )) EntryType> + ad_utility::SameAsAny) EntryType> static EntryType& addEntryToContainerVector( PointerVector& targetVector, auto&&... constructorArgs) { targetVector.push_back(ad_utility::make_copyable_unique( diff --git a/src/backports/concepts.h b/src/backports/concepts.h index 07b013570d..8c762d878a 100644 --- a/src/backports/concepts.h +++ b/src/backports/concepts.h @@ -13,14 +13,22 @@ // `QL_OPT_CONCEPT(arg)` which expands to `arg` in C++20 mode, and to nothing in // C++17 mode. It can be used to easily opt out of concepts that are only used // for documentation and increased safety and not for overload resolution. -// Example usage: +// Example usages: // `(QL_OPT_CONCEPT(std::view) auto x = someFunction();` +// `void f(QL_OPT_CONCEPT(std::view) auto x) {...}` +// +// `QL_CONCEPT_OR_TYPENAME(arg)` which expands to `arg` in C++20 mode, and to +// `typename` in C++17 mode. Example: `template +// ) T> void f(){...}` +// +// Note: The macros are variadic to allow for commas in the argument (e.g. +// `QL_OPT_CONCEPT(SameAsAny)`. #ifdef QLEVER_CPP_17 -#define QL_OPT_CONCEPT(arg) -#define QL_CONCEPT_OR_TYPENAME(arg) typename +#define QL_OPT_CONCEPT(...) +#define QL_CONCEPT_OR_TYPENAME(...) typename #else -#define QL_OPT_CONCEPT(arg) arg -#define QL_CONCEPT_OR_TYPENAME(arg) arg +#define QL_OPT_CONCEPT(...) __VA_ARGS__ +#define QL_CONCEPT_OR_TYPENAME(...) __VA_ARGS__ #endif // The namespace `ql::concepts` includes concepts that are contained in the diff --git a/src/util/ConfigManager/ConfigManager.cpp b/src/util/ConfigManager/ConfigManager.cpp index 3410fd1720..18bf449de8 100644 --- a/src/util/ConfigManager/ConfigManager.cpp +++ b/src/util/ConfigManager/ConfigManager.cpp @@ -255,8 +255,8 @@ requires std::is_object_v auto ConfigManager::allHashMapEntries( } // ____________________________________________________________________________ -template )) ReturnReference> +template ) + ReturnReference> std::vector> ConfigManager::configurationOptionsImpl( SimilarTo> auto& diff --git a/src/util/ConfigManager/ConfigManager.h b/src/util/ConfigManager/ConfigManager.h index 123ae2a262..0cf110b09b 100644 --- a/src/util/ConfigManager/ConfigManager.h +++ b/src/util/ConfigManager/ConfigManager.h @@ -580,7 +580,8 @@ class ConfigManager { @tparam ReturnReference Should be either `ConfigOption&`, or `const ConfigOption&`. */ - template + template ) ReturnReference> static std::vector> configurationOptionsImpl( SimilarTo> auto& diff --git a/src/util/Iterators.h b/src/util/Iterators.h index 1337b63e27..93ae1b51f4 100644 --- a/src/util/Iterators.h +++ b/src/util/Iterators.h @@ -2,13 +2,13 @@ // Chair of Algorithms and Data Structures. // Author: Johannes Kalmbach -#ifndef QLEVER_ITERATORS_H -#define QLEVER_ITERATORS_H +#pragma once #include #include #include +#include "backports/algorithm.h" #include "util/Enums.h" #include "util/TypeTraits.h" @@ -399,5 +399,3 @@ class InputRangeTypeErased { using iterator = typename InputRangeFromGet::Iterator; }; } // namespace ad_utility - -#endif // QLEVER_ITERATORS_H diff --git a/src/util/JoinAlgorithms/JoinAlgorithms.h b/src/util/JoinAlgorithms/JoinAlgorithms.h index e44569809b..494dc88918 100644 --- a/src/util/JoinAlgorithms/JoinAlgorithms.h +++ b/src/util/JoinAlgorithms/JoinAlgorithms.h @@ -9,6 +9,7 @@ #include #include "backports/algorithm.h" +#include "backports/concepts.h" #include "engine/idTable/IdTable.h" #include "global/Id.h" #include "util/Generator.h" @@ -762,13 +763,8 @@ struct BlockZipperJoinImpl { #if defined(Side) || defined(Blocks) #error Side or Blocks are already defined #endif -#ifdef QLEVER_CPP_17 -#define Side auto -#define Blocks auto -#else -#define Side SameAsAny auto -#define Blocks SameAsAny auto -#endif +#define Side QL_OPT_CONCEPT(SameAsAny) auto +#define Blocks QL_OPT_CONCEPT(SameAsAny) auto // Type alias for the result of the projection. Elements from the left and // right input must be projected to the same type.