about shared_ptr and object_pool

Hi dear all. I have a class named "session" look like below code: class session : public boost::enable_shared_from_this< session >, private boost::noncopyable { public: session(boost::asio::io_service& io_service); ..... }; I want use boost::object_pool for allocate memory for session. class host { public: typedef boost::object_pool<session> session_pool; host() : new_session_( session_pool_.construct(), boost::bind(&session_pool::destroy, &session_pool_)) { } public: boost::shared_ptr< session > new_session_; session_pool session_pool_; }; but there has a compiler error was occured: 1> d:\development\boost_1_35_0\boost\bind.hpp(1613) : warning C4180: qualifier applied to function type has no meaning; ignored 1> d:\development\boost_1_35_0\boost\bind.hpp(1647) : see reference to class template instantiation 'boost::_bi::add_cref<Pm,I>' being compiled 1> with 1> [ 1> Pm=void (__thiscall boost::object_pool<session>::* )(session *), 1> I=1 1> ] 1> d:\development\coreframework\portal\src\portal_server.cpp(16) : see reference to class template instantiation 'boost::_bi::dm_result<Pm,A1>' being compiled 1> with 1> [ 1> Pm=void (__thiscall boost::object_pool<session>::* )(session *), 1> A1=portal_server::session_pool *__w64 1> ] 1>d:\development\boost_1_35_0\boost\mem_fn.hpp(318) : warning C4180: qualifier applied to function type has no meaning; ignored 1> d:\development\boost_1_35_0\boost\bind\bind_template.hpp(344) : see reference to class template instantiation 'boost::_mfi::dm<R,T>' being compiled 1> with 1> [ 1> R=void (session *), 1> T=boost::object_pool<session> 1> ] 1>Project : error PRJ0002 : Error result 1 returned from 'C:\Program Files\Microsoft Visual Studio 8\VC\bin\cl.exe'. I use Microsoft visual studio 8 (vs2005). Thanks all Best regards. Yours Kenneth.Sh

Hi lgor R It's working now, very thanks for your help :) Best regards. Kenneth.Sh 2008/7/31 Igor R <boost.lists@gmail.com>
: new_session_( session_pool_.construct(), boost::bind(&session_pool::destroy, &session_pool_))
boost::bind(&session_pool::destroy, &session_pool_, _1) _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Best Regards, Ken Zhang Greatelsoft Co., Ltd. mailto:ken@greatelsoft.com http://www.greatelsoft.com M/P:0086-1350-191-6596
participants (2)
-
Igor R
-
Ken zhang