Saturday, April 8, 2023

Digest for comp.lang.c++@googlegroups.com - 5 updates in 3 topics

red floyd <no.spam.here@its.invalid>: Apr 07 07:50PM -0700

> when comparing STL containers containing ci_string it didn't.
 
> Sometimes I can understand why some people just give up with C++ and use
> something else. It really shouldn't be this hard to do something this simple.
 
Technically it uses std::less, not "operator <". The Standard permits
specializing std::less for your type.
Bonita Montero <Bonita.Montero@gmail.com>: Apr 08 03:49PM +0200

Am 07.04.2023 um 05:13 schrieb Bonita Montero:
 
> {
>     return str << out.c_str();
> }
 
Or better this:
 
template<typename CharT, typename StreamTraits, typename StringTraits,
typename Alloc>
basic_ostream<CharT, StreamTraits> &operator <<( basic_ostream<CharT,
StreamTraits> &str, basic_string<CharT, StringTraits, Alloc> const &out )
{
return str << basic_string_view<CharT, StreamTraits>( out.cbegin(),
out.cend() );
}
Bonita Montero <Bonita.Montero@gmail.com>: Apr 08 05:14PM +0200

Am 08.04.2023 um 15:49 schrieb Bonita Montero:
 
>     return str << basic_string_view<CharT, StreamTraits>( out.cbegin(),
> out.cend() );
> }
 
Or how about that:
 
template<typename CharT, typename StreamTraits, typename Container>
requires random_access_iterator<decltype(Container().cbegin())> &&
same_as<iter_value_t<decltype(Container().cbegin())>, CharT>
&& random_access_iterator<decltype(Container().cend())> && same_as <
iter_value_t<decltype(Container().cend())>, CharT>
basic_ostream<CharT, StreamTraits>& operator <<( basic_ostream<CharT,
StreamTraits>& str, Container const &out )
{
return str << basic_string_view<CharT, StreamTraits>(out.cbegin(),
out.cend());
}
 
With that you could even print a vector
of chars without any additional effort.
Jorgen Grahn <grahn+nntp@snipabacken.se>: Apr 08 08:38AM

On Tue, 2023-03-28, Paavo Helde wrote:
 
> If anything, naming both the member and the constructor parameter with
> the same name does not help readability (but works as intended, in the
> member initialization list).
 
I'm more worried by the lack of "explicit". Given the names "Item" and
"Container", the OP probably doesn't want one to confuse them.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
Jorgen Grahn <grahn+nntp@snipabacken.se>: Apr 08 08:33AM

On Mon, 2023-04-03, Anssi Saari wrote:
 
> And that's where we disagree. AltGr with anything isn't fast or easy in
> my opinion, it's good for those symbols used once a month or
> thereabouts. I get you don't get it, moving on.
 
You're not disagreeing; you obviously use keyboards differently and
you're both happy with your setups.
 
Personally I'm in the US camp. If I had to work with a Swedish layout
I'd be slowed down and distracted -- when writing C++ code, but mainly
when doing Unix command line things.
 
/Jorgen
 
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: