Tag: boost

使shared_ptr不使用删除

在我的代码我想boost :: shared_ptr不要调用删除,而是调用ptr-> deleteMe()来代替。 另外我有几个C风格的函数返回一个ptr。 我可以叫它lib_freeXYZ(ptr); 而不是试图删除?

在一个集合中合并多个集合元素

我想知道是否有任何标准库或增强工具,以轻松合并多个集合的内容到一个单一的。 在我的情况下,我有一些我想要合并的整数。

从shared_ptr获得正常的ptr?

我有类似于shared_ptr<Type> t(makeSomething(), mem_fun(&Type::deleteMe))我现在需要调用C风格的函数,需要一个指向Type的指针。 我如何从shared_ptr获取它?

应该std :: bind与boost :: asio兼容吗?

我正在尝试使用boost :: asio示例之一来尽可能地使用c ++ 11 / TR1库。 原始代码如下所示: void start_accept() { tcp_connection::pointer new_connection = tcp_connection::create(acceptor_.get_io_service()); acceptor_.async_accept(new_connection->socket(), boost::bind(&tcp_server::handle_accept, this, new_connection, boost::asio::placeholders::error)); } 如果我用std::bindreplaceboost::bind ,如下所示: void start_accept() { tcp_connection::pointer new_connection = tcp_connection::create(acceptor_.get_io_service()); acceptor_.async_accept(new_connection->socket(), std::bind(&tcp_server::handle_accept, this, new_connection, boost::asio::placeholders::error ) ); // std::bind(&tcp_server::handle_accept, this, new_connection, _1 ) ); } 我收到一个很大的错误信息,结尾是: /usr/include/c++/4.4/tr1_impl/functional:1137: error: return-statement with a value, in function returning […]

在C ++ Boost库中,为什么某些头文件中存在“.ipp”扩展名

在C ++ Boost库中,为什么在某些头文件中有“.ipp”扩展名? 看起来他们是同名的“.hpp”文件包含的头文件。 这个约定在Boost之外是否共同? 什么是具有特殊文件types的理由?

boost.org的Spirit parser-generator框架的缺点是什么?

在几个问题中,我看到了来自boost.org的Spiritparsing器 – 生成器框架的build议 ,但是在评论中,那些使用Spirit的人感到抱怨并不开心。 请这些人站出来向我们解释使用圣灵有什么缺点或缺点?

C ++ Boost:这个警告的原因是什么?

我有一个简单的C ++ Boost像这样: #include <boost/algorithm/string.hpp> int main() { std::string latlonStr = "hello,ergr()()rg(rg)"; boost::find_format_all(latlonStr,boost::token_finder(boost::is_any_of("(,)")),boost::const_formatter(" ")); 这工作正常; 它代替()的每一个出现,用“” 不过,编译时出现这个警告: 我正在使用MSVC 2008,升压1.37.0。 1>Compiling… 1>mainTest.cpp 1>c:\work\minescout-feat-000\extlib\boost\algorithm\string\detail\classification.hpp(102) : warning C4996: 'std::copy': Function call with parameters that may be unsafe – this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. […]

什么是std :: pair?

什么是std::pair ,为什么我会使用它, boost::compressed_pair带来了什么好处?

为什么Loki图书馆没有被广泛使用?

Loki库实现了一些非常广泛使用的概念(智能指针,访客,工厂等)。 经常提到相关书籍“现代C ++devise”,但库本身没有被广泛使用。 这是为什么? 大多数开发者似乎更喜欢Boost。 特别是,为什么人们经常决定使用Boost的智能指针而不是Loki?

同居的boost :: shared_ptr和std :: shared_ptr

我想在某些时候使用boost::log ,但是我不能传递std::shared_ptr作为参数,因为编译器(VS2010)不能将它转换成boost::shared_ptr 。 我真的不喜欢他们是彼此外星人的事实。 有没有一种安全而透明的方法可以将一个人变成另一个人,以免彼此绊倒? 我不认为这两个问题是相同的这个问题的重复。