Deutsch   English   Français   Italiano  
<utmo8b$3m8el$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: DFS <nospam@dfs.com>
Newsgroups: comp.os.linux.advocacy
Subject: Re: Tabs As Syntax
Date: Sat, 23 Mar 2024 10:16:46 -0400
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <utmo8b$3m8el$1@dont-email.me>
References: <17be73f7d87a06e9$246570$4075406$802601b3@news.usenetexpress.com>
 <utejt0$1fq95$1@dont-email.me> <uterkv$1haln$2@dont-email.me>
 <l624u3Fn16lU13@mid.individual.net> <uthf4s$28e7g$1@dont-email.me>
 <l64bi6F2m1hU17@mid.individual.net> <utjt1t$2tns5$1@dont-email.me>
 <utl4m5$3700q$6@dont-email.me> <utmgt6$3k6u5$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 23 Mar 2024 14:16:44 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="0f26139fa1f569a69bed5a06a43fb65b";
	logging-data="3875285"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19Umgtr3QOuMFzeKEj1r0Bw"
User-Agent: Betterbird (Windows)
Cancel-Lock: sha1:XGwogZ9gN0eGxlHOb3T+0uG236g=
In-Reply-To: <utmgt6$3k6u5$3@dont-email.me>
Content-Language: en-US
Bytes: 1949

On 3/23/2024 8:11 AM, Chris Ahlstrom wrote:

> te<typename ... Args>
> std::string string_format (const std::string & format, Args ... args)
> {
>      std::string result;
>      size_t sz = std::snprintf(nullptr, 0, format.c_str(), args ...);
>      if (sz > 0)
>      {
>          std::unique_ptr<char []> buf(new char[sz + 1]);
>          std::snprintf(buf.get(), sz + 1, format.c_str(), args ...);
>          result = std::string(buf.get(), buf.get() + sz);
>      }
>      return result;
> }
> 
> Note the variadic template.


I note the two thousand uses of std::.

Couldn't you just use 'using namespace std;' inside this function (or 
whatever this 'te' thing is?)