.. _sprout-string-basic_string-tuple_get: ############################################################################### tuple_get ############################################################################### Interface ======================================== .. sourcecode:: c++ template inline SPROUT_CONSTEXPR T& tuple_get(sprout::basic_string& t) SPROUT_NOEXCEPT; template inline SPROUT_CONSTEXPR T const& tuple_get(sprout::basic_string const& t) SPROUT_NOEXCEPT; template inline SPROUT_CONSTEXPR T&& tuple_get(sprout::basic_string&& 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 = string<8>("homuhomu"); static_assert(sprout::get<4>(input) == 'h', "an element at position 4 is h."); Complexity ======================================== | Recursive function invocations in *O(1)* (constant) depth. Header ======================================== | ``sprout/string/tuple.hpp`` | Convenience header: ``sprout/string.hpp``