mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Meng Zhu <m...@mesosphere.io>
Subject Re: Review Request 70067: Added star operator for `Result`, `Try` and `Option`.
Date Sat, 09 Mar 2019 01:56:58 GMT


> On March 2, 2019, 7:24 a.m., Benjamin Mahler wrote:
> > 3rdparty/stout/tests/option_tests.cpp
> > Lines 137 (patched)
> > <https://reviews.apache.org/r/70067/diff/3/?file=2127552#file2127552line137>
> >
> >     this doesn't test that moving is working correctly? Can we test to ensure that
this operator lets just move?
> >     
> >     ```
> >     Option<hashmap<int,int>> moved = {{1,1}};
> >     
> >     hashmap<int,int> map = *std::move(moved);
> >     
> >     // Expect moved is empty
> >     // Expect map is {1,1}
> >     ```
> 
> Benjamin Bannier wrote:
>     Hmm, is there anything in the standard promising that the source of a `move` gets
emptied out? I am not sure adding an expectation related to `move`.
> 
> Meng Zhu wrote:
>     I do not think we need to test content after the move, just need to test the returned
content of the `*` which the code has already tested. Dropping, Bmahler please feel free to
re-open if you think otherwise.
> 
> Benjamin Mahler wrote:
>     As it stands, the test would compile if it actually was copying instead of moving?
Or no?
>     
>     Seems prudent to test a move is actually occurring, if there's nothing in std containers
to rely on w.r.t post-move invariants, we can just have our own struct that stores a boolean
indicating that it's been moved and we can test that to make sure the move actually occurs?

OK, added a custom type to verify the moving. Funny that it actually leads me to find missing
constructors in `Try` which would lead to redundant copy and convoluted logic.


- Meng


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/70067/#review213350
-----------------------------------------------------------


On March 8, 2019, 5:56 p.m., Meng Zhu wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/70067/
> -----------------------------------------------------------
> 
> (Updated March 8, 2019, 5:56 p.m.)
> 
> 
> Review request for mesos, Benjamin Bannier and Benjamin Mahler.
> 
> 
> Bugs: MESOS-7124
>     https://issues.apache.org/jira/browse/MESOS-7124
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Added star operator for `Result`, `Try` and `Option`.
> 
> 
> Diffs
> -----
> 
>   3rdparty/stout/include/stout/option.hpp 8feed012a55fed6eab89c883958324f3345e46e9 
>   3rdparty/stout/include/stout/result.hpp c1387ae957edffc31250b9b236b5f1fd8ff0acd3 
>   3rdparty/stout/include/stout/try.hpp 30cce7e27fa040d0ce5a86efc4820f8c39178444 
>   3rdparty/stout/tests/option_tests.cpp 815d40e0bf342998634dc69a1719c3f717c7202c 
>   3rdparty/stout/tests/result_tests.cpp 1750e6b4a90afec3b7de0621779f8b69a856da41 
>   3rdparty/stout/tests/try_tests.cpp 99b7b2a3f968abb87549fb9075d65bc5bcc827f1 
> 
> 
> Diff: https://reviews.apache.org/r/70067/diff/5/
> 
> 
> Testing
> -------
> 
> make check
> 
> 
> Thanks,
> 
> Meng Zhu
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message