Do any of the standard's people read HN, or is there a way of submitting requests? The STL could seriously use some improvements. std::string doesn't do most of the stuff you want with a string; updating it to an interface like Python's string would be nice. Having a std::vector::append() would be really nice, so I don't have to remember that C++ uses something completely different from every other language. Convenie…
> std::set::contains() I live in a "fast languages only when necessary, and with restraint" shop. Our C++ is not idiomatic, it is meant for programmers from other languages. Anything with iterators is a bit sketchy. It tends to look more like C than C++, and now that I'm an old person I am perfectly happy with that. We use `s.count(i) == 1`. It's ok -- clear, readable etc. Doesn't give you an iterator if you want to…
C++17 Standard Published
41–50 of 85 posts
Re: C++17 Standard Published
#42Do any of the standard's people read HN, or is there a way of submitting requests? The STL could seriously use some improvements. std::string doesn't do most of the stuff you want with a string; updating it to an interface like Python's string would be nice. Having a std::vector::append() would be really nice, so I don't have to remember that C++ uses something completely different from every other language. Convenie…
Wasn't that the incentive behind the D language?
Re: C++17 Standard Published
#43Re: C++17 Standard Published
#44Earlier quoted context omitted.
It's not as major of an update as previous releases, but there are a lot of little convenience features. String views, same-line nested namespaces, [[fallthrough]], if with init (I'm sure Google single-handedly got this included; it's very Go-reminiscent and really nice when not using exceptions), structured bindings, maybes with std::optional (occasionally useful), and even just something as simple as emplace return…
std::move should extend the lifetime of a temporary like static_cast does. (Or else not accept temporaries). Otherwise, no new features necessary. But that one bites sometimes.
Re: C++17 Standard Published
#45Earlier quoted context omitted.
> std::set::contains() I live in a "fast languages only when necessary, and with restraint" shop. Our C++ is not idiomatic, it is meant for programmers from other languages. Anything with iterators is a bit sketchy. It tends to look more like C than C++, and now that I'm an old person I am perfectly happy with that. We use `s.count(i) == 1`. It's ok -- clear, readable etc. Doesn't give you an iterator if you want to…
Oooph, I'm no expert but that is not "good" C++ style. Definitely prefer using the iterator methods.
Re: C++17 Standard Published
#46Do any of the standard's people read HN, or is there a way of submitting requests? The STL could seriously use some improvements. std::string doesn't do most of the stuff you want with a string; updating it to an interface like Python's string would be nice. Having a std::vector::append() would be really nice, so I don't have to remember that C++ uses something completely different from every other language. Convenie…
std::string predates the STL and most of unicodes history. It was supposed to a be an alternative for using C functions for manipulating NTBS's, nothing more. Since then we've only really had 3 standard revisions, and most languages that see constant evolution still haven't got unicode right...
> Having a std::vector::append() would be really nice, so I don't have to remember that C++ uses something completely different from every other language
I can think of a bunch of languages that don't use "append" for pushing on to the back of a dynamic array. JavaScript for instance, which uses "push"
> I'm wondering if we ought to start thinking about a C++2.0 where we can write the C++ that we've learned we want.
The Ranges proposal/TS goes quite far in this direction. See Eric Nieblers range-v3 library as a testing ground.
Re: C++17 Standard Published
#47Re: C++17 Standard Published
#48Earlier quoted context omitted.
You can build the pdf yourself from the LaTeX source: https://github.com/cplusplus/draft Or get the latest public draft from https://wg21.link/standard Or an html version: http://eelis.net/c++draft/
Thanks. I just like having an official (not draft) copy. I'm a nerd. I just built from the LaTeX source and it's 32 pages longer than the public draft in the second link from 6 weeks ago. Maybe just additional descriptive language, but...
Re: C++17 Standard Published
#49Do I really have to pay for a pdf of the standard? (sorry I just don't see anyway else to download the pdf)
Just go to https://github.com/cplusplus/draft for drafts. Choose a draft version that is produced right before the actual date of standardization and there are only very minor differences between the draft and the real deal.
Re: C++17 Standard Published
#50Long gone days where template meta-programming was the only way to do compile-time code generation and constant checks.... at least that's my impression of the latest language-level features.
I have not worked professionally with c++ for a few years now, but his piece from the article, just seems rather powerful incarnation of the compile-time programming.
constexpr auto add = [] (int x, int y) {
auto L = [=] { return x; };
auto R = [=] { return y; };
return [=] { return L() + R(); };
};