- C++, CPP-Functions, cpp-tuple

std::tuple_element() and std::tuple_size() in C++ with Examples

std::tuple_element() and std::tuple_size() in C++ with ExamplesA tuple is an object that can hold a number of elements. The elements can be different data types. The elements of tuples are initialized as arguments in the order in which they will be accessed.The functions-tuple_element() and tuple_size()are only defined for elements using tuple_like interface.tuple_element():The C++ function tuple_element(array) provides compile-type indexed access to the type of the elements of the array using a tuple-like interface.Syntax-template< size_t I, class T, size_t N >
struct tuple_element;Parameters-T − type for which the tuple element is obtained.
I − index of the element.
N − the size of the array.Example-Below is the C++ program to implement the concept of tuple_element(array)-C++  #include #include #include #include using namespace std;  int main(){        array data{ 3, 5, 10 };          using type = std::tuple_element::type;              cout