.. _sprout-array-array-tuple_get: ############################################################################### tuple_get ############################################################################### Interface ======================================== .. sourcecode:: c++ template inline SPROUT_CONSTEXPR T& tuple_get(sprout::array& t) SPROUT_NOEXCEPT; template inline SPROUT_CONSTEXPR T const& tuple_get(sprout::array const& t) SPROUT_NOEXCEPT; template inline SPROUT_CONSTEXPR T&& tuple_get(sprout::array&& t) SPROUT_NOEXCEPT; Requires ======================================== | ``I < N``. The program is ill-formed if I is out of bounds. Returns ======================================== | A reference to the Ith element of a, where indexing is zero-based. | or | A const reference to the Ith element of a, where indexing is zero-based. | or | Equivalent to ``return move(tuple_get(t));`` Notes ======================================== | ``sprout::get(t)`` (same as sprout::tuples::get) is a valid call, because ``tuple_get(t)`` ADL callable is defined. Examples ======================================== .. sourcecode:: c++ #include using namespace sprout; SPROUT_STATIC_CONSTEXPR auto input = array{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}; static_assert(sprout::get<5>(input) == 6, "an element at position 5 is 6."); Complexity ======================================== | Recursive function invocations in *O(1)* (constant) depth. Header ======================================== | ``sprout/array/tuple.hpp`` | Convenience header: ``sprout/array.hpp``