From patchwork Mon Nov 21 18:51:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 60940 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A645D384D9A7 for ; Mon, 21 Nov 2022 18:51:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A645D384D9A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669056710; bh=MRjEiZ7wUY3XUlAxRBHoSNeG7an9wnuCafF4RFJfEFo=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=YhqqZQo3mzMRW2oeDA/6JRydlFg9WPstvl75mDjYg1NjRffdVzlJXeh/LDzIxlfcI lGHphqUyZBLOJkTutpX1gJhu1thMK/5nHH2rJqa09ggmup4i8zzDEGRKyJLzts3v1d suMOs6Xe+7+Bi4Pjkpnsbqie9rUdbPQ78BAMu37Y= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 746BC384F4B0 for ; Mon, 21 Nov 2022 18:51:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 746BC384F4B0 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-134-h70zcJxrMNiH1AonW7LpTg-1; Mon, 21 Nov 2022 13:51:17 -0500 X-MC-Unique: h70zcJxrMNiH1AonW7LpTg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3ED3A800B23; Mon, 21 Nov 2022 18:51:17 +0000 (UTC) Received: from localhost (unknown [10.33.36.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 047C2492B06; Mon, 21 Nov 2022 18:51:16 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Improve Doxygen comments in Date: Mon, 21 Nov 2022 18:51:15 +0000 Message-Id: <20221121185115.2021818-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Tested x86_64-linux. Pushed to trunk. -- >8-- libstdc++-v3/ChangeLog: * include/std/tuple: Add better Doxygen comments. --- libstdc++-v3/include/std/tuple | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 26e248431ec..0ac592d8d94 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -1980,6 +1980,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif // three_way_comparison // NB: DR 705. + /// Create a tuple containing copies of the arguments template constexpr tuple::__type...> make_tuple(_Elements&&... __args) @@ -1991,7 +1992,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2275. Why is forward_as_tuple not constexpr? - /// std::forward_as_tuple + /// Create a tuple of lvalue or rvalue references to the arguments template constexpr tuple<_Elements&&...> forward_as_tuple(_Elements&&... __args) noexcept @@ -2018,7 +2019,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION constexpr const _Tp&& get(const array<_Tp, _Nm>&&) noexcept; - + /// @cond undocumented template struct __make_tuple_impl; @@ -2130,8 +2131,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template struct __is_tuple_like_impl> : true_type { }; + /// @endcond - /// tuple_cat + /// Create a `tuple` containing all elements from multiple tuple-like objects template...>::value>::type> constexpr auto @@ -2146,13 +2148,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2301. Why is tie not constexpr? - /// tie + /// Return a tuple of lvalue references bound to the arguments template constexpr tuple<_Elements&...> tie(_Elements&... __args) noexcept { return tuple<_Elements&...>(__args...); } - /// swap + /// Exchange the values of two tuples template _GLIBCXX20_CONSTEXPR inline @@ -2177,6 +2179,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif // C++23 #if __cplusplus > 201402L || !defined(__STRICT_ANSI__) // c++1z or gnu++11 + /// Exchange the values of two const tuples (if const elements can be swapped) template _GLIBCXX20_CONSTEXPR typename enable_if...>::value>::type @@ -2197,6 +2200,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // _GLIBCXX_RESOLVE_LIB_DEFECTS // 2773. Making std::ignore constexpr + /** Used with `std::tie` to ignore an element of a tuple + * + * When using `std::tie` to assign the elements of a tuple to variables, + * unwanted elements can be ignored by using `std::ignore`. For example: + * + * ``` + * int x, y; + * std::tie(x, std::ignore, y) = std::make_tuple(1, 2, 3); + * ``` + * + * This assignment will perform `x=1; std::ignore=2; y=3;` which results + * in the second element being ignored. + * + * @since C++11 + */ _GLIBCXX17_INLINE constexpr _Swallow_assign ignore{}; /// Partial specialization for tuples