boost

CMake FindPackage fails for custom built boost libraries

。_饼干妹妹 提交于 2020-06-01 07:13:26
问题 I am trying to build a native Android project that requires Boost library. I have built Boost for the platforms I am targeting using this git project. But for some reason find_package() for Boost fails to find the Boost header paths Below is the project structure and for the Android app, and location where I have placed the Boost library. android_app ├── src │ └──<folder> │ └──<folder> │ └──CMakeLists.txt └── lib └── boost_armeabi-v7a ├── include │ └── boost_1_68_0 │ └──boost │ ├──align.hpp │

cmake v3.15.3 cannot find boost v1.71.0

别说谁变了你拦得住时间么 提交于 2020-06-01 07:12:32
问题 I am trying to build from source the following software in Windows 10: https://github.com/FreeOpcUa/freeopcua. I have also installed the latest version of the boost libraries ( boost_1_71_0 ) but when I try to use CMake for compiling the source code, CMake cannot find the location of boost. Environment: Windows 10 CMake version: 3.15.3 boost version: 1.71.0 I have downloaded the latest version of boost from this link: https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.zip I

cmake v3.15.3 cannot find boost v1.71.0

家住魔仙堡 提交于 2020-06-01 07:11:03
问题 I am trying to build from source the following software in Windows 10: https://github.com/FreeOpcUa/freeopcua. I have also installed the latest version of the boost libraries ( boost_1_71_0 ) but when I try to use CMake for compiling the source code, CMake cannot find the location of boost. Environment: Windows 10 CMake version: 3.15.3 boost version: 1.71.0 I have downloaded the latest version of boost from this link: https://dl.bintray.com/boostorg/release/1.71.0/source/boost_1_71_0.zip I

Undefined reference errors in simple boost serialization

不打扰是莪最后的温柔 提交于 2020-05-28 04:20:30
问题 I have a minimal example of Boost serialization where I try to save an integer in a binary archive file Here is main.cpp: #include <iostream> #include <fstream> #include <boost/archive/binary_oarchive.hpp> int main() { int t = 0; std::ofstream file("Test.bin"); boost::archive::binary_oarchive archive(file); archive << t; file.close(); return 0; } and here is the CMake file: cmake_minimum_required(VERSION 3.15) project(Test) set(CMAKE_CXX_STANDARD 17) find_package(Boost REQUIRED serialization)

What is the equivalent of boost::make_transform_iterator in the standard library?

你离开我真会死。 提交于 2020-05-26 10:34:46
问题 When dealing with a const vector, the following doesn't work: const std::vector<std::string> v; v.push_back("test"); // error: v cannot be modified Instead, you have to initialize the vector on the same line where it is constructed. However, even with this restriction, boost::make_transform_iterator makes it easy to do something with another vector's elements before pushing them into v. In this example, convert is a unary function that returns a transformed version of an input element: auto

boost::asio::streambuf - how to reuse buffer?

↘锁芯ラ 提交于 2020-05-26 04:02:07
问题 I'm implementing TCP server that uses both asio socket.async_read() and boost::asio::async_read_until() methods for asynchronous reading data from socket. Both use the same handler for reading data from boost::asio::streambuf. The handler that perfectly works invoked via async_read() : void handle_read(const boost::system::error_code& ec, std::size_t ytes_transferred) ) { m_request_buffer.commit(bytes_transferred); boost::asio::streambuf::const_buffers_type rq_buf_data = m_request_buffer.data

How to pipe into std::cout with boost::iostreams

孤者浪人 提交于 2020-05-23 09:52:49
问题 I am new to boost::iostreams so this might be trivial: Assuming namespace io = boost::iostreams; this works io::filtering_ostream out(std::cout); out << "some\nstring\n"; and this works std::string result; io::filtering_ostream out(io::counter() | io::back_inserter(result)); out << "some\nstring\n"; yet this does not compile io::filtering_ostream out(io::counter() | std::cout); out << "some\nstring\n"; How do you pipe into std::cout ? 回答1: Wrapping std::cout with boost::ref worked for me: io:

Boost serializing armadillo matrices

喜欢而已 提交于 2020-05-16 20:55:07
问题 I'm trying to make sure serializing works for matrices i.e. Armadillo and I'm getting some errors. I made a simple example of a random matrix and am trying to save the content using boost in a binary file, then load it using boost: #include <iostream> #include <fstream> #include <boost/archive/tmpdir.hpp> #include <boost/archive/binary_oarchive.hpp> #include <boost/archive/binary_iarchive.hpp> #include <armadillo> int main() { arma::mat A = arma::randu<arma::mat>(4,5); std::ofstream

Boost Graph Library, Erdos Renyi Generator. Graphs always have same number of edges

岁酱吖の 提交于 2020-05-16 02:42:07
问题 I'm trying to generate Erdos-Renyi graphs using boost graph library. In the code below, which is taken from The Boost 1.72 documentation the networks always have the same number of edges (they should not, for particular p values). I have tried using different random seeds to no avail. Thanks for any help. #include <boost/graph/adjacency_list.hpp> #include <boost/graph/erdos_renyi_generator.hpp> #include <boost/random/linear_congruential.hpp> #include <iostream> using namespace std; typedef

Boost Graph Library, Erdos Renyi Generator. Graphs always have same number of edges

≡放荡痞女 提交于 2020-05-16 02:42:07
问题 I'm trying to generate Erdos-Renyi graphs using boost graph library. In the code below, which is taken from The Boost 1.72 documentation the networks always have the same number of edges (they should not, for particular p values). I have tried using different random seeds to no avail. Thanks for any help. #include <boost/graph/adjacency_list.hpp> #include <boost/graph/erdos_renyi_generator.hpp> #include <boost/random/linear_congruential.hpp> #include <iostream> using namespace std; typedef