Re: [Boost-bugs] [Boost C++ Libraries] #7888: circular_buffer should support move semantics

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #7888: circular_buffer should support move semantics
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2014-05-23 18:00:11


#7888: circular_buffer should support move semantics
-------------------------------+------------------------------------------
  Reporter: holmes@… | Owner: apolukhin
      Type: Feature Requests | Status: reopened
 Milestone: To Be Determined | Component: circular_buffer
   Version: Boost 1.52.0 | Severity: Problem
Resolution: | Keywords: circular_buffer move emplace
-------------------------------+------------------------------------------

Comment (by michael.broida@…):

 Apparently it's just the circular_buffer ctor.\\
 (scopenames removed to make it easier to read.)

 {{{
 struct TestSetupContainers
 {
   TestSetupContainers()
   {
     output_object_pool_ = new
 GrowingMemoryPool<sizeof(OutputObject)>(11,0, "TestSetupContainers
 MemoryPool");
     OutputObject::SetMemoryPool(output_object_pool_);
     output_buffer_.resize(10);
   }

   GrowingMemoryPool<sizeof(OutputObject)> *output_object_pool_;
   boost::circular_buffer<boost::shared_ptr<OutputObject>> output_buffer_;
 };
 }}}

 That last line is in our file !OutputObject-UT.cpp line 20, the line
 triggering this long warning:\\
 (This is with VS2010; Boost 1.55.0)\\
 (long paths shortened to ....)

 {{{
 1> OutputObject-UT.cpp
 1>....include\boost\circular_buffer\base.hpp(201): error C2220: warning
 treated as error - no 'object' file generated
 1> ....include\boost\circular_buffer\base.hpp(2199) : see
 reference to function template instantiation 'const boost::shared_ptr<T>
 &boost::circular_buffer<boost::shared_ptr<T>>::move_if_noexcept<boost::shared_ptr<T>>(ValT
 &)' being compiled
 1> with
 1> [
 1> T=OutputObject,
 1> ValT=boost::shared_ptr<OutputObject>
 1> ]
 1> ....include\boost\circular_buffer\base.hpp(2191) : while
 compiling class template member function
 'boost::cb_details::iterator<Buff,Traits>
 boost::circular_buffer<T>::erase(boost::cb_details::iterator<Buff,Traits>,boost::cb_details::iterator<Buff,Traits>)'
 1> with
 1> [
 1>
 Buff=boost::circular_buffer<boost::shared_ptr<OutputObject>>,
 1>
 Traits=boost::cb_details::nonconst_traits<std::allocator<OutputObjectHandle>>,
 1> T=boost::shared_ptr<OutputObject>
 1> ]
 1> ....outputobject-ut.cpp(20) : see reference to class template
 instantiation 'boost::circular_buffer<T>' being compiled
 1> with
 1> [
 1> T=boost::shared_ptr<OutputObject>
 1> ]
 1>....include\boost\circular_buffer\base.hpp(201): warning C4172:
 returning address of local variable or temporary
 }}}

 I -was- able to avoid the warning by #pragma disabling it for the entire
 method in Boost's circular_buffer\base.hpp lines 189-200. That just seems
 like cheating, though. :) (I can't even figure out that method
 '''name'''!)

 I hope that helps. Let me know if you need more information.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/7888#comment:25>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:16 UTC