OpenVDB: index_sequence< Ns > Struct Template Reference

OpenVDB 13.0.0

Loading...
Searching...
No Matches
index_sequence< Ns > Struct Template Reference

Re-implementation of C++17's index_sequence and the helper alias make_index_sequence. This was introduced to fix an issue with clang's builtin implementation which treats template specializations of builtin templates differently when a subsequent parameter is dependent. The result is a resolution failure during partial specialization selection. For example, the following will fail to specialize: More...

`#include <openvdb/Types.h>`

## Detailed Description

template<std::size_t... Ns>
struct openvdb::v13_0::index_sequence< Ns >

Re-implementation of C++17's index_sequence and the helper alias make_index_sequence. This was introduced to fix an issue with clang's builtin implementation which treats template specializations of builtin templates differently when a subsequent parameter is dependent. The result is a resolution failure during partial specialization selection. For example, the following will fail to specialize:

struct Test { static const int VALUE = 1; };
template <typename T, typename S = std::make_index_sequence<T::VALUE>>
struct Item {};
template <typename T> struct Adapter {};
template <typename T> struct Adapter<Item<T>> {}; // FAIL: will never be selected.

This is fixed from Clang16. See also: https://reviews.llvm.org/D133262 https://github.com/llvm/llvm-project/issues/42102 https://github.com/llvm/llvm-project/issues/51928 https://github.com/llvm/llvm-project/commit/f4ea3bd4b2086e6de10131b197aaf7d066a24df8