Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.c++.moderated    |    Moderated discussion of C++ superhackery    |    33,346 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 33,293 of 33,346    |
|    =?UTF-8?B?RGFuaWVsIEtyw7xnbGVy?= to All    |
|    Re: auto-generated move assignment and b    |
|    28 Feb 14 16:40:49    |
   
   From: daniel.kruegler@googlemail.com   
      
   Am 28.02.2014 18:07, schrieb Krzysztof Czaiński:   
   > I think this became clear to me now. I will now try to verify my   
   > understanding with some statements about this example:   
   >   
   > struct B // movable only   
   > {   
   > B() = default;   
   > B( B const& ) = delete;   
   > B( B&& ) = default;   
   > B& operator=( B ) {}   
   > };   
   >   
   > - B has a copy assignment operator.   
      
   Yes, it has an explicitly declared and user-provided copy assignment operator   
   (see below for one further remark to the definition).   
      
   > - B has no move assignment operator.   
      
   Correct, there is no implicitly nor an explicitly declared move-assignment   
   operator (The otherwise applicable implicit declaration is suppressed because   
   of the existence of the user-declared copy-constructor, move-constructor, and   
   copy-assignment    
   operators [each of them would have been an exclusion argument]).   
      
   > - B is not copy assignable.   
      
   Yes, I would say that it does neither satisfy the CopyAssignable requirements   
   nor should std::is_copy_assignable::value evaluate to true.   
      
   > - B is move assignable.   
      
   Assuming you would fix the return statement, yes, this type would satisfy the   
   MoveAssignable requirements and std::is_move_assignable::value would   
   evaluate to true (already without the fix, because the latter is based on an   
   unevaluated expression test)   
   .   
      
   > - B is trivially copyable.   
      
   No, because you have failed to satisfy:   
      
   "has no non-trivial copy assignment operators"   
      
   since the type has one non-trivial copy-assignment operator (because it is   
   user-provided).   
      
   HTH & Greetings from Bremen,   
      
   Daniel Krügler   
      
      
   --   
    [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
    [ comp.lang.c++.moderated. First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca