diff --git a/include/bpptree/detail/ordered_detail.hpp b/include/bpptree/detail/ordered_detail.hpp index fcf2bb1..75c641e 100644 --- a/include/bpptree/detail/ordered_detail.hpp +++ b/include/bpptree/detail/ordered_detail.hpp @@ -16,6 +16,12 @@ namespace bpptree::detail { +template +struct IsPtrOrSmartPtr : std::false_type {}; + +template +struct IsPtrOrSmartPtr())>>> : std::true_type {}; + template struct HasDataPtr : std::false_type {}; @@ -38,9 +44,9 @@ struct OrderedDetail { template IndexType find_key_index(Key const& search_val, Comp const& comp) const { - if constexpr (std::is_pointer_v) { + if constexpr (IsPtrOrSmartPtr::value) { for (IndexType i = 0; i < this->length; ++i) { - __builtin_prefetch(extractor.get_key(this->values[i]), 0, 3); + __builtin_prefetch(&*extractor.get_key(this->values[i]), 0, 3); } } if constexpr (HasDataPtr::value) { @@ -254,9 +260,9 @@ struct OrderedDetail { template IndexType find_key_index(Key const& search_val, Comp const& comp) const { - if constexpr (std::is_pointer_v) { + if constexpr (IsPtrOrSmartPtr::value) { for (IndexType i = 0; i < this->length; ++i) { - __builtin_prefetch(keys[i], 0, 3); + __builtin_prefetch(&*keys[i], 0, 3); } } if constexpr (HasDataPtr::value) {