In range-v3, view_facade
class has begin()
function.
template<typename D = Derived, CONCEPT_REQUIRES_(Same<D, Derived>())>
detail::facade_iterator_t<D> begin()
{
return {range_access::begin_cursor(derived(), 42)};
}
And the range_access::begin_cursor()
is implemented like this,
template<typename Rng>
static RANGES_CXX14_CONSTEXPR auto begin_cursor(Rng & rng, long) // --1
RANGES_DECLTYPE_AUTO_RETURN
(
rng.begin_cursor()
)
template<typename Rng>
static RANGES_CXX14_CONSTEXPR auto begin_cursor(Rng & rng, int) // --2
RANGES_DECLTYPE_AUTO_RETURN
(
static_cast<Rng const &>(rng).begin_cursor()
)
In my VS, it looks the second function is always called.
I wonder when the magic number (42) is converted into long
to call first function.