HybridTreePath incompatibility
- The
treePath
method does not enforce any type for the arguments for theHybridTreePath
. - On the other hand,
push_front
andpush_back
are hard-coded to usestd::size_t
orindex_constant<k>
. Therefore, a push on a dynamic index induces a cast tostd::size_t
.
Therefore, the following code does not work:
auto path = treePath(1); // path is HybridTreePath<int>
path = push_back(treePath(),front(tree)); // Error: not known conversion from HybridTreePath<std::size_t> to HybridTreePath<int>
- For example, if the path is a template parameter to a class (e.g. constructed in user code with
treePath()
), it won't be compatible with a library algorithm that constructs paths withpush_back
to store the path into the object. - I think that this is rather inconvenient and I would even say it's a bug since the expected behaviour is to either cast everything to
std::size_t
or to accept arbitrary types.
Edited by Santiago Ospina De Los Ríos