From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [80.241.56.151]) by sourceware.org (Postfix) with ESMTPS id 41E8A3858C74 for ; Sun, 20 Nov 2022 20:17:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 41E8A3858C74 Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=aarsen.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=aarsen.me Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4NFhf64yn1z9sQf; Sun, 20 Nov 2022 21:17:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aarsen.me; s=MBO0001; t=1668975470; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=4hhH5lvQSYvvwLlFWNtzTatBNy03RGPMSPMRX2yZmwM=; b=XYdlwBp17TvfFzhpuNJY0FfPxfN0hsu0VOCCIee2f7+Co1Bg8UitG4cRV+Ig0h7cye7dAP rlgvnMffRqqLZI98LjKyEnmgbfuNP9g/rnGlR88SWn3p2AdQNDUmxjSnMeTv2wpilcJ3w7 TzNfGZTPlmdmpI4pHxeYBeyQhIHuYOjtjnbDSODbVNTvwsUxG1mVVFCi8xdUBHlNWdXASV Pw3zuBi763KVZJ90jyXwm8wJFe9Ryv0EXLHPWIJdFxNAaLOgNkZ9e0YUL2/9Q2zRhwAAYl YPIM5+0L1XeoOKMXk0i1DTXDdkfWNd5t0J8AJSyODv8NEqBT9lX2+j/j5B8m6A== References: From: Arsen =?utf-8?Q?Arsenovi=C4=87?= To: "Tan, Qiye" Cc: libstdc++@gcc.gnu.org Subject: Re: Where is the definition of some member functions (ex. __gnu_debug::_Safe_iterator_base::_M_detach())? Date: Sun, 20 Nov 2022 21:01:25 +0100 In-reply-to: Message-ID: <86wn7ps7mc.fsf@aarsen.me> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_INFOUSMEBIZ,KAM_SHORT,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Evening, "Tan, Qiye via Libstdc++" writes: > I'm new in C++ who have an interest in the implementation of C++ STL. > Recently, I tried to implement my own vector template. However, when I > implemented my own iterator, I found that I had no idea how to > detect whether it is dereferencable. Therefore, I began to explore the > libstdc++, but I found that for some member functions, I can only find the > declaration but no definition. For example, the 'bool > __gnu_debug::_Safe_iterator_base::_M_singular( ) const', 'void > __gnu_debug::_Safe_iterator_base::_M_detach( )', etc. They are declared = in > 'libstdc++-v3/include/debug/safe_base.h'. I can guess that '_M_singular' > may just check if '_M_sequence' is NULL, but I still want to find their > definition. Can someone help me? Thank you so much. _M_singular() and _M_detach() are implemented in src/c++11/debug.cc. A complete iterator implementation technically doesn't need either, these are used for debugging purposes in libstdc++, see also https://gcc.gnu.org/onlinedocs/gcc-12.2.0/libstdc++/api/a05206.html Do keep in mind that the __gnu_debug namespace is only used in case that _GLIBCXX_DEBUG is set, see https://gcc.gnu.org/onlinedocs/gcc-12.2.0/libstdc++/manual/manual/debug_mod= e.html Hope that helps, have a great night! =2D-=20 Arsen Arsenovi=C4=87 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iOYEARYKAI4WIQT+4rPRE/wAoxYtYGFSwpQwHqLEkwUCY3qLa18UgAAAAAAuAChp c3N1ZXItZnByQG5vdGF0aW9ucy5vcGVucGdwLmZpZnRoaG9yc2VtYW4ubmV0RkVF MkIzRDExM0ZDMDBBMzE2MkQ2MDYxNTJDMjk0MzAxRUEyQzQ5MxAcYXJzZW5AYWFy c2VuLm1lAAoJEFLClDAeosST+XIA/04nUuLRYE+WBkJJwgn40ERWlUjESzXgk6ly MNOnMsUYAP47tuM9Wvo/THqWa/cVdcKJk7AGt0NKRyKPKnf14685CA== =YE2U -----END PGP SIGNATURE----- --=-=-=--