December 19, 2019 Re: [SAoC] Move semantics and STL containers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suleyman | Recapitulation of milestone 3: * Ported GCC and Clang std::vector. * Implemented the rest of std::string for MSVC, GCC, and Clang. * Fixed issue 20235[1] which was a blocker for both std::string and std::vector. * Fixed a mangling issues which was blocking std::pair. [1] : https://issues.dlang.org/show_bug.cgi?id=20235 |
December 19, 2019 Re: [SAoC] Move semantics and STL containers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suleyman | On Thursday, 19 December 2019 at 03:46:56 UTC, Suleyman wrote:
> Recapitulation of milestone 3:
>
> * Ported GCC and Clang std::vector.
> * Implemented the rest of std::string for MSVC, GCC, and Clang.
> * Fixed issue 20235[1] which was a blocker for both std::string and std::vector.
> * Fixed a mangling issues which was blocking std::pair.
std::pair is just a std::tuple, so does this mean std::tuple is usable?
(great effort, std::vector is important :-)
|
December 19, 2019 Re: [SAoC] Move semantics and STL containers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ola Fosheim Grøstad | On Thursday, 19 December 2019 at 13:49:36 UTC, Ola Fosheim Grøstad wrote:
> std::pair is just a std::tuple, so does this mean std::tuple is usable?
Careful: while std::pair is semantically a 2-tuple, it is actually a completely separate type and not a specialization.
My guess is that this can't be corrected now because std::pair is older than std::tuple and was used in std::map and related associative containers.
|
December 19, 2019 Re: [SAoC] Move semantics and STL containers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Gregor Mückl | On Thursday, 19 December 2019 at 20:09:36 UTC, Gregor Mückl wrote:
> On Thursday, 19 December 2019 at 13:49:36 UTC, Ola Fosheim Grøstad wrote:
>> std::pair is just a std::tuple, so does this mean std::tuple is usable?
>
> Careful: while std::pair is semantically a 2-tuple, it is actually a completely separate type and not a specialization.
>
> My guess is that this can't be corrected now because std::pair is older than std::tuple and was used in std::map and related associative containers.
Yes, it predates C++11 and the members are called first and second, but supports all the same operations except assignment?
So the D implementation should be similar, I think?
(I consider pair to be legacy so I don't use it anymore.)
|
December 19, 2019 Re: [SAoC] Move semantics and STL containers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ola Fosheim Grøstad | On Thursday, 19 December 2019 at 22:58:06 UTC, Ola Fosheim Grøstad wrote:
> So the D implementation should be similar, I think?
What I mean by this is that if you implement std::tuple in D, you only need to swap out the mangling to get pair, everything else should be the same.
(On the C++ side things like assignment does not work between pair and tuple, but the attribute names are not relevant for D, since D interface with the memory-object.)
|
December 21, 2019 Re: [SAoC] Move semantics and STL containers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ola Fosheim Grøstad | On Thursday, 19 December 2019 at 13:49:36 UTC, Ola Fosheim Grøstad wrote: > On Thursday, 19 December 2019 at 03:46:56 UTC, Suleyman wrote: >> [...] > > std::pair is just a std::tuple, so does this mean std::tuple is usable? It was on the TODO list but since you asked for it here it is https://github.com/dlang/druntime/pull/2879. unique_ptr in the GCC implementation also uses std::tuple internally. |
December 21, 2019 Re: [SAoC] Move semantics and STL containers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suleyman | On Saturday, 21 December 2019 at 11:55:24 UTC, Suleyman wrote:
> It was on the TODO list but since you asked for it here it is https://github.com/dlang/druntime/pull/2879. unique_ptr in the GCC implementation also uses std::tuple internally.
I see you implemented tuple concatenation as well. That is pretty cool!
|
December 22, 2019 Re: [SAoC] Move semantics and STL containers | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ola Fosheim Grøstad | On Saturday, 21 December 2019 at 12:40:08 UTC, Ola Fosheim Grøstad wrote:
> On Saturday, 21 December 2019 at 11:55:24 UTC, Suleyman wrote:
>> [...]
>
> I see you implemented tuple concatenation as well. That is pretty cool!
It's a lot easier to implement in D than in C++ thanks to AliasSeq. AliasSeq isn't perfect but is very powerful.
|
Copyright © 1999-2021 by the D Language Foundation