home bbs files messages ]

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 32,340 of 33,346   
   =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to Frank Bergemann   
   Re: fighting with move sematics and std:   
   29 May 12 12:53:53   
   
   b0889732   
   From: daniel.kruegler@googlemail.com   
      
   On 2012-05-28 19:13, Frank Bergemann wrote:   
   > So here's the updated version:   
      
   [..]   
      
   > The reason for need of copy constructor seems to be the   
   > FunctionTracker::make(...).   
   > it uses:   
   >     return FunctionTracker(funcName,   
   > std::make_tuple(std::move(args)...));   
   > I guess this "formally" requires the copy c'tor(?)   
   > (see my comment:   
   > 		// cannot delete copy c'tor   
   > 		// because FunctionTracker::Make formally requires it   
   > 		// though doesn't actually use if (RVO)   
   > )   
   > That's why i cannot use "= delete" for those.   
   > However, as the copy c'tor (now) are not used actually, i implemented   
   > them, but raise a runtime exception in case they WOULD be used.   
   > I want the Function::Tracker::make(...) to serve for type-   
   > transformation.   
   > Is there a better way to resolve this conflict?   
      
   If you want to exclude copy semantics and restrict to move semantics it   
   would be much better to mark all copy constructors as deleted   
   (explicitly or implicitly) and to define corresponding move   
   constructors. In C++11 a move-only type can be returned from functions   
   and can be provided as function parameter.   
      
   Further, I don't see any good reasons for the const data members in   
   FunctionTrackerImpl: If you want to create a move-only type from this,   
   you should better remove the top-level const specifier from the member   
   declarations.   
      
   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