Boost logo

Boost Users :

Subject: [Boost-users] is this possible with tuples in c++0x ?
From: Germán Diago (germandiago_at_[hidden])
Date: 2009-05-08 20:37:40


template <typename... Types>
class tuple ...

{

    template <typename N>
    auto operator[](std::size_t n = N) -> constexpr decltype(get<N>(*this))
    {
        return get<N>(*this);
    }
};

If this is possible, you could do (and it would be way more natural
than get<3>(t)):

tuple<int, float, float, string, mytype> t;

t[3] = "hello";

But I feel this is not legal because of parameter std::size_t :(.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net