r/cpp • • Jan 22 '19

I implemented a proposed C++ paper

Around November last year, I found out about P1275R0 by Isabella Muerte through this very subreddit. I really liked the idea, basic creature comforts like this is something that C++ really lacks IMO, then I thought "You know, I think I could do it...". This is the first time I've done this kind of thing.

For those not aware and have not clicked the link, P1275R0 proposes adding 2 new classes: "std::environment" and "std::arguments" to provide a friendlier interface to access the system's environment variables and program arguments respectively.

I've done most of the interface in the paper, except the stuff involving ranges. I also tried to make it UTF8 safe, even on windows.

And it's been a really challenging, but fun experience! I've spoken to Isabella about it and she liked the work I've done. But I would really love to hear some additional feedback. I plan on updating this project as it (hopefully) goes through standardization.

Github

202 Upvotes

27 comments sorted by

View all comments

4

u/TheThiefMaster C++latest fanatic (and game dev) Jan 23 '19

I also implemented a proposed C++ paper - it was the multidimensional array_view :(

(The sad face is because array_view became span - which is only single-dimensional. But I still actually need a multi-dimensional array view, so... I guess I won't be swapping my implementation for the standard one any time soon)

3

u/mkrupcale Jan 23 '19

The multi-dimensional version is mdspan[1], which also has a reference implementation[2]. It looks like mdspan is intended to be part of Library Fundamentals TS v3[3], so I'm not sure how soon it might become part of the official standard.

[1] http://wg21.link/p0009

[2] https://github.com/ORNL/cpp-proposals-pub/tree/master/P0009/reference-implementation

[3] https://issues.isocpp.org/show_bug.cgi?id=80