Live data from Hacker News

C++17 Standard Published

iso.org

41–50 of 85 posts

Re: C++17 Standard Published

#41
post #35

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…

Oooph, I'm no expert but that is not "good" C++ style. Definitely prefer using the iterator methods.

Re: C++17 Standard Published

#42
post #35

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…

> 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.

Wasn't that the incentive behind the D language?

Re: C++17 Standard Published

#44
post #30

Earlier 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.

[deleted]

Re: C++17 Standard Published

#45
post #41

Earlier 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.

If it effectively solves your particular problems in your specific situation, then it IS good style ;)

Re: C++17 Standard Published

#46
post #35

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…

> The STL could seriously use some improvements. std::string doesn't do most of the stuff you want with a string

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

#47
The way coroutines are implemented in C++17 is just beautiful. Minimal language changes, compatible down to C function pointers and void*, and extensible to almost any existing asynchronous library via trait specialisation.

Re: C++17 Standard Published

#48
post #10

Earlier 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...

The C++ draft and published standard are so similar, the only parties I imagine would need the published copy are gcc frontend developers, technical managers at IBM, etc. As an individual who gets into the deep dark crevices of C++, I've never needed the tiny details the published standard offers. They are mostly typographical.

Re: C++17 Standard Published

#49
post #12

Do 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.

Yes, I should emphasize that the minor differences are really minor and mostly typographical. There's no reason to need the published copy over the draft unless you're IBM working on icc, one of the head gcc maintainers, etc.

Re: C++17 Standard Published

#50
Seems like the meta-language (compile-time expressions) is now pretty much full fledged.

Long 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(); };
  };
Post reply on HN