When to make a type non-movable in C++11?

前端 未结 4 1791
耶瑟儿~
耶瑟儿~ 2020-11-29 15:40

I was surprised this didn\'t show up in my search results, I thought someone would\'ve asked this before, given the usefulness of move semantics in C++11:

When do I

4条回答
  •  半阙折子戏
    2020-11-29 16:27

    Actually when I search around, I found quite some types in C++11 are not movable:

    • all mutex types(recursive_mutex , timed_mutex, recursive_timed_mutex,
    • condition_variable
    • type_info
    • error_category
    • locale::facet
    • random_device
    • seed_seq
    • ios_base
    • basic_istream::sentry
    • basic_ostream::sentry
    • all atomic types
    • once_flag

    Apparently there is a discussion on Clang: https://groups.google.com/forum/?fromgroups=#!topic/comp.std.c++/pCO1Qqb3Xa4

提交回复
热议问题