I am wondering if the C++11 standard gives any requirement about the type of the std::tuple returned by std::tie when some arguments are std::ignore.
More specifically, can I assume that:
decltype(std::tie(42, std::ignore)) is not the same as decltype(std::tie(std::ignore, 42))
decltype(std::tie(42, std::ignore)) is not the same as decltype(std::tie(42))
decltype(std::tie(std::ignore, 42)) is not the same as decltype(std::tie(42))
decltype(std::tie(std::ignore, std::ignore)) is not the same as decltype(std::tie(std::ignore))
In other words, from the type perspective, does the generated tuple behaves as a tuple which has type decltype(std::ignore) for all template arguments that match std::ignore by position?
Yes you can, std::tie returns a std::tuple<T&...> where T... are the types that are given to it.std::ignore has an unspecified type, but it will still appear in the tuple according to where you specified it in std::tie.  
If if makes you feel better, you could include in your code somewhere:
    int n;
    auto i = std::tie(std::ignore, n);
    auto j = std::tie(n, std::ignore);
    auto k = std::tie(n);
    static_assert(!std::is_same<decltype(i), decltype(j)>::value, "");
    static_assert(!std::is_same<decltype(i), decltype(k)>::value, "");
    static_assert(!std::is_same<decltype(j), decltype(k)>::value, "");
and so on for whatever combinations you are explicitly using. This way compilation will fail if your assumption is invalid.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With