I am not a language lawyer, so I am going to answer this question as best as possible.
ignore is on the tuple resume in tuple.general as such:
// [tuple.creation], tuple creation functions: const unspecified ignore;
As you noticed, the libstdc ++ implementation defines ignore as follows:
// A class (and instance) which can be used in 'tie' when an element // of a tuple is not required struct _Swallow_assign { template<class _Tp> const _Swallow_assign& operator=(const _Tp&) const { return *this; } };
While the libC ++ version defines it as follows:
template <class _Up> struct __ignore_t { template <class _Tp> _LIBCPP_INLINE_VISIBILITY const __ignore_t& operator=(_Tp&&) const {return *this;} };
Thus, it compiles in libC ++. Now the definition of std::tie can be found in [tuple.creation], which says:
Returns: tuple<Types&...>(t...) . When the argument in t is ignore , assigning any value to the corresponding element of the tuple, no effect.
This doesn't say anything about ignore , so I'm going to do this before unspecified behavior. You can claim this behavior is undefined by omission, but it can stretch it.
uh oh somebody needs a pupper
source share