Some std::optional
constructors use an std::in_place_t
tag parameter like this:
template< class... Args >
explicit optional( std::in_place_t, Args&&... args );
I see that such constructors could be implemented without the in-place tag and use some enable_if
(SFINAE) magic to not participate as unwilling overloads, i.e.:
template< class... Args >
explicit optional( Args&&... args );
Why are std::optional
’s in-place constructors implemented with an std::in_place_t
tag rather than with some enable_if
magic (and no tag)?
Update: Question is slightly updated to emphasize that I realize that simply omitting the in-place tag wouldn’t work.