// SPDX-FileCopyrightText: Copyright (c) 2008-2018, NVIDIA Corporation. All rights reserved. // SPDX-License-Identifier: Apache-2.0 /*! \file tuple.h * \brief A type encapsulating a heterogeneous collection of elements. */ /* * Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi) * * Distributed under the Boost Software License, Version 1.0. * (See accompanying NOTICE file for the complete license) * * For more information, see http://www.boost.org */ #pragma once #include #if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC) # pragma GCC system_header #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG) # pragma clang system_header #elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC) # pragma system_header #endif // no system header #include THRUST_NAMESPACE_BEGIN /*! \addtogroup utility * \{ */ /*! \addtogroup tuple * \{ */ /*! This metafunction returns the type of a * \p tuple's Nth element. * * \tparam N This parameter selects the element of interest. * \tparam T A \c tuple type of interest. * * \see pair * \see tuple * * \deprecated Use cuda::std::tuple_element instead * * \verbatim embed:rst:leading-asterisk * .. versionadded:: 2.2.0 * \endverbatim */ #ifdef _CCCL_DOXYGEN_INVOKED // Provide a fake alias for doxygen template using tuple_element = ::cuda::std::tuple_element; #else // ^^^ _CCCL_DOXYGEN_INVOKED ^^^ / vvv !_CCCL_DOXYGEN_INVOKED vvv using ::cuda::std::tuple_element; #endif // _CCCL_DOXYGEN_INVOKED /*! This metafunction returns the number of elements * of a \p tuple type of interest. * * \tparam T A \c tuple type of interest. * * \see pair * \see tuple * * \deprecated Use cuda::std::tuple_size instead * * \verbatim embed:rst:leading-asterisk * .. versionadded:: 2.2.0 * \endverbatim */ #ifdef _CCCL_DOXYGEN_INVOKED // Provide a fake alias for doxygen template using tuple_size = ::cuda::std::tuple_size; #else // ^^^ _CCCL_DOXYGEN_INVOKED ^^^ / vvv !_CCCL_DOXYGEN_INVOKED vvv using ::cuda::std::tuple_size; #endif // _CCCL_DOXYGEN_INVOKED /*! \brief \p tuple is a heterogeneous, fixed-size collection of values. * An instantiation of \p tuple with two arguments is similar to an * instantiation of \p pair with the same two arguments. Individual elements * of a \p tuple may be accessed with the \p get function. * * \tparam Ts The type of the N \c tuple element. Thrust's \p tuple * type currently supports up to ten elements. * * The following code snippet demonstrates how to create a new \p tuple object * and inspect and modify the value of its elements. * * \code * #include * #include * * int main() { * // Create a tuple containing an `int`, a `float`, and a string. * thrust::tuple t(13, 0.1f, "thrust"); * * // Individual members are accessed with the free function `get`. * std::cout << "The first element's value is " << thrust::get<0>(t) << '\n'; * * // ... or the member function `get`. * std::cout << "The second element's value is " << t.get<1>() << '\n'; * * // We can also modify elements with the same function. * thrust::get<0>(t) += 10; * } * \endcode * * \see pair * \see get * \see make_tuple * \see tuple_element * \see tuple_size * \see tie * * \deprecated Use cuda::std::tuple instead * * \verbatim embed:rst:leading-asterisk * .. versionadded:: 2.2.0 * \endverbatim */ #ifdef _CCCL_DOXYGEN_INVOKED // Provide a fake alias for doxygen template using tuple = ::cuda::std::tuple; #else // ^^^ _CCCL_DOXYGEN_INVOKED ^^^ / vvv !_CCCL_DOXYGEN_INVOKED vvv using ::cuda::std::tuple; #endif // _CCCL_DOXYGEN_INVOKED using ::cuda::std::get; using ::cuda::std::make_tuple; using ::cuda::std::tie; /*! \} // tuple */ /*! \} // utility */ THRUST_NAMESPACE_END