New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSVS does not support move semantics for some STL constructs #4299
Comments
One worry is that using noexcept is actually leading to a performance loss on MSVS:
I dont think that is a really worry because (i) this only affects the move constructor and (ii) if the move constructor is actually used by MSVC (and not the copy constructor) then we will have a net performance gain even if the
|
Is there in theory a third option to use (unique) pointers to the maps in those classes? I am aware though that it would require larger changes. I would have no problems with 2) if it will be clear where the error comes from, when the error occurs (std::bad_alloc?). I agree that we probably cannot recover the cases where it fails anyhow. |
I also agree now that we probably do not need to worry about noexcept vs. non-noexcept for now, as long as the move constructor is used. |
I dont think you will be a in a great place when a |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
We are currently facing this issue for
which all have a member of type
std::map
,Map
,std::set
,std::set
or inherit from it. Currently its not quite clear how to solve this. this is also related to #3758 and #4276 where the same issue came up and has been discussed in #4290How to deal with MSVC
The main problem seems to be that MSVC does not make the
std::map
move constructornoexcept
while GCC does [1]. This means that classes that have astd::map
member or inherit from it cannot have anoexcept
move constructor either, which actually has a performance impact when using these objects in STL containers. Since the STL cannot be sure that the move constructor does not throw, it will use the copy constructor instead when copying around arrays etc. There are two ways to deal with this behaviorRefs
The text was updated successfully, but these errors were encountered: