Is std::ranges::size supposed to return an unsigned integer?
Here it is written that std::ranges::size
should return an unsigned integer. However, when I use it on an Eigen vector (with Eigen 3.4) the following compiles:
Eigen::VectorXd x;
static_assert(std::same_as<Eigen::VectorXd::Index,
decltype(std::ranges::size(x))>);
where Eigen::VectorXd::Index
is notoriously a signed integer. By looking at the implementation of std::ranges::size
, I noticed that the return type is inferred from the return type of x.size()
, which is precisely Eigen::VectorXd::Index
. Is this a bug of std::ranges::size
? Or is this expected?
from Recent Questions - Stack Overflow https://ift.tt/3mpnzmM
https://ift.tt/eA8V8J
Comments
Post a Comment