this post was submitted on 19 Jun 2025
331 points (90.7% liked)
Programmer Humor
24815 readers
180 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Rust is verbose, but C++ might still take the cake with its standard library templates. Especially when using fully-qualified type names...
auto a = ::std::make_shared<::std::basic_string<char, ::std::char_traits<char>, MyAllocator<char>>>();
A reference-counted shared pointer to a string of unspecified character encoding and using a non-default memory allocator.
std::string
doesn't have a template type for the allocator. You are stuck using the verbosebasic_string
type if you need a special allocator.But, of course, nobody sane would write that by hand every time. They would use a typedef, like how
std::string
is just a typedef forstd::basic_string<char, std::char_traits<char>, std::allocator<char>>
. Regardless, the C++ standard library is insanely verbose when you start dropping down into template types and using features at an intermediate level. SFINAE in older versions of C++ was mindfuck on the best of days, for example.Don't get me wrong, though. I'm not saying Rust is much better. Its saving grace is its type inference in
let
expressions. Without it, chaining functional operations on iterators would be an unfathomable hellscape ofCollect<Skip<Map<vec::Iter<Item = &'a str>>>>
Yeah, I missed the custom allocator at first. I thought I deleted my comment fast enough, but I guess you were faster. :)