Skip to content

Commit d121ffe

Browse files
authored
Avoid having an explicit policy for the BuilderHolder (#14353)
Shortens the symbol name. We can still override the policy via template specialization.
1 parent bec22ff commit d121ffe

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Framework/Core/include/Framework/TableBuilder.h

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,16 @@ struct CachedInsertion {
456456
int pos = 0;
457457
};
458458

459-
template <size_t I, typename T, typename P>
460-
struct BuilderHolder : P {
459+
template <typename T>
460+
struct InsertionTrait {
461+
static consteval DirectInsertion<T> policy();
462+
using Policy = decltype(policy());
463+
};
464+
465+
template <size_t I, typename T>
466+
struct BuilderHolder : InsertionTrait<T>::Policy {
461467
static constexpr size_t index = I;
462-
using Policy = P;
468+
using Policy = typename InsertionTrait<T>::Policy;
463469
using ArrowType = typename detail::ConversionTraits<T>::ArrowType;
464470
using BuilderType = typename arrow::TypeTraits<ArrowType>::BuilderType;
465471

@@ -520,12 +526,6 @@ constexpr auto tuple_to_pack(std::tuple<ARGS...>&&)
520526
return framework::pack<ARGS...>{};
521527
}
522528

523-
template <typename T>
524-
struct InsertionTrait {
525-
static consteval DirectInsertion<T> policy();
526-
using Policy = decltype(policy());
527-
};
528-
529529
/// Helper function to convert a brace-initialisable struct to
530530
/// a tuple.
531531
template <class T>
@@ -553,15 +553,15 @@ template <typename... ARGS>
553553
constexpr auto makeHolderTypes()
554554
{
555555
return []<std::size_t... Is>(std::index_sequence<Is...>) {
556-
return std::tuple(BuilderHolder<Is, ARGS, typename InsertionTrait<ARGS>::Policy>(arrow::default_memory_pool())...);
556+
return std::tuple(BuilderHolder<Is, ARGS>(arrow::default_memory_pool())...);
557557
}(std::make_index_sequence<sizeof...(ARGS)>{});
558558
}
559559

560560
template <typename... ARGS>
561561
auto makeHolders(arrow::MemoryPool* pool, size_t nRows)
562562
{
563563
return [pool, nRows]<std::size_t... Is>(std::index_sequence<Is...>) {
564-
return new std::tuple(BuilderHolder<Is, ARGS, typename InsertionTrait<ARGS>::Policy>(pool, nRows)...);
564+
return new std::tuple(BuilderHolder<Is, ARGS>(pool, nRows)...);
565565
}(std::make_index_sequence<sizeof...(ARGS)>{});
566566
}
567567

@@ -579,7 +579,7 @@ class TableBuilder
579579
static void throwError(RuntimeErrorRef const& ref);
580580

581581
template <typename... ARGS>
582-
using HoldersTuple = typename std::tuple<BuilderHolder<0, ARGS, typename InsertionTrait<ARGS>::Policy>...>;
582+
using HoldersTuple = typename std::tuple<BuilderHolder<0, ARGS>...>;
583583

584584
template <typename... ARGS>
585585
using HoldersTupleIndexed = decltype(makeHolderTypes<ARGS...>());

0 commit comments

Comments
 (0)