Skip to content

Commit 29af31b

Browse files
committed
specialization concept
1 parent 47e4c3f commit 29af31b

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

DataFormats/simulation/include/SimulationDataFormat/ConstMCTruthContainer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class ConstMCTruthContainer : public std::vector<char>
116116
#ifndef GPUCA_STANDALONE
117117
namespace o2::framework
118118
{
119+
// FIXME: this is potentially dangerous
119120
template <typename T>
120121
struct is_specialization<o2::dataformats::ConstMCTruthContainer<T>, std::vector> : std::true_type {
121122
};

Framework/Core/include/Framework/DataAllocator.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ class DataAllocator
179179
.get();
180180
}
181181

182-
template <typename T, typename... Args>
183-
requires VectorOfMessageableTypes<T>
182+
template <VectorOfMessageableTypes T, typename... Args>
184183
decltype(auto) make(const Output& spec, Args... args)
185184
{
186185
auto& timingInfo = mRegistry.get<TimingInfo>();

Framework/Foundation/include/Framework/Traits.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#define O2_FRAMEWORK_TRAITS_H_
1313

1414
#include <type_traits>
15+
#include <concepts>
1516

1617
namespace o2::framework
1718
{
@@ -30,6 +31,11 @@ struct is_specialization<Ref<Args...>, Ref> : std::true_type {
3031
template <typename T, template <typename...> class Ref>
3132
inline constexpr bool is_specialization_v = is_specialization<T, Ref>::value;
3233

34+
template <template <typename...> typename B, typename S>
35+
concept specialization = requires {
36+
{[]<typename... Ts>(B<Ts...>*) -> B<Ts...> {}(std::declval<S*>())} -> std::same_as<S>;
37+
};
38+
3339
template <typename A, typename B>
3440
struct is_overriding : public std::bool_constant<std::is_same_v<A, B> == false && std::is_member_function_pointer_v<A> && std::is_member_function_pointer_v<B>> {
3541
};

0 commit comments

Comments
 (0)