boost

CMake Error while using find_package(Boost … ) in CMakeLists.txt: No suitable build variant has been found

删除回忆录丶 提交于 2021-01-28 09:09:52
问题 When using CMake, I get the following error when calling find_package(Boost 1.6 COMPONENTS program_options thread system REQUIRED) : -- Boost include dirs: C:/dev/boost/include/boost-1_72 -- Boost libraries: Boost library -- Found Boost 1.72.0 at C:/dev/boost/lib/cmake/Boost-1.72.0 -- Requested configuration: QUIET REQUIRED COMPONENTS program_options;thread;system -- BoostConfig: find_package(boost_headers 1.72.0 EXACT CONFIG REQUIRED QUIET HINTS C:/dev/boost/lib/cmake) -- BoostConfig: find

boost read_wkt produced invalid polygon

♀尐吖头ヾ 提交于 2021-01-28 08:48:22
问题 In the following code I use read_wkt to initialize a polygon . The polygon two holes. #include <iostream> #define BOOST_GEOMETRY_TEST_DEBUG #include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> namespace bg = boost::geometry; namespace bgm = bg::model; typedef double base_type; typedef bgm::d2::point_xy<base_type> point_type; typedef bgm::polygon<point_type> polygon_type; typedef bgm::multi_polygon<polygon_type> multipolygon_type; int main() { polygon_type in; bg:

How to get information about free memory from /dev/shm

风流意气都作罢 提交于 2021-01-28 08:00:28
问题 I need a way in C or C++ to get the free memory available from /dev/shm . Note that on my ARM architecure on Linux, unfortunately, ipcs reports a wrong max. available memory information, but df -h correctly gives me the current available memory from tmpfs . The problem is that I am trying to allocate shared memory via boost::interprocess::shared_memory_object::truncate , but this function does not throw when the memory is not available. This problem is not apparently in boost::interprocess ,

Cross-Compiling Boost on Windows for Raspberry Pi using SysGCC Toolchain and MinGW

会有一股神秘感。 提交于 2021-01-28 07:39:39
问题 I currently trying to cross-compile Boost 1.64.0 on Windows 7 (64bit) for the Raspberry Pi (running Jessie) using the Raspberry SysGCC 4.9.2 Toolchain and MinGW 6.3.0. I installed everything to the following directories: Boost to C:\Boost\1.64.0 SysGCC to C:\SysGCC\Raspberry MinGW to C:\MinGW\6.3.0 Added the bin folders of SysGCC and MinGW to the global PATH variable: C:\SysGCC\Raspberry\bin C:\MinGW\6.3.0\mingw32\bin And created a user-config.jam with the following content in my home

boost::variant apply static_visitor to certain types

一个人想着一个人 提交于 2021-01-28 07:12:22
问题 I have the following variant: typedef boost::variant<int, float, bool> TypeVariant; And I want to create a visitor to convert a int or float type to a bool type. struct ConvertToBool : public boost::static_visitor<TypeVariant> { TypeVariant operator()(int a) const { return (bool)a; } TypeVariant operator()(float a) const { return (bool)a; } }; However this is giving me the error message: 'TypeVariant ConvertToBool::operator ()(float) const': cannot convert argument 1 from 'T' to 'float' What

isupper and islower for wstring

老子叫甜甜 提交于 2021-01-28 07:07:53
问题 I have a std::wstring and I want to find which character are upper case and which ones are lowercase. the std::isupper and islower seems to work on ASCII characters only but I want to be able to find out all kinds of uppercase and lowercase characters e.g. á is an "Latin small letter a with acute" and Á is an "Latin capital letter A with acute" similarly ä and Ä are lower and upper case german letters. Is there any function (mfc, boost or in any other library) which I can use to find out if a

Incorporating boost random number generator as a class variable

孤街醉人 提交于 2021-01-28 06:55:06
问题 I'm trying to create a wrapper class for the boost random number generator, based on http://www.sitmo.com/article/generating-random-numbers-in-c-with-boost/. The problem is that boost uses templates and I don't know how to separate the declaration of GEN gen from the instantiation, like what can be done with separating DIST dist from dist = DIST(0, 1) . Any advice appreciated. fr.hpp: #include <boost/random/variate_generator.hpp> #include <boost/generator_iterator.hpp> #include <boost/random

Boost includes wreaks havoc - but it's not Boost's fault

二次信任 提交于 2021-01-28 05:46:28
问题 I am introducing Boost into my project and as soon as I include Boost headers ( #include <boost/property_tree/ptree.hpp> ) in a particular file I get errors in the boost headers. Here is a short snippet of the errors: 1>c:\boost\include\boost-1_57\boost\mpl\eval_if.hpp(28): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 1>c:\boost\include\boost-1_57\boost\mpl\eval_if.hpp(28): error C2143: syntax error : missing ',' before 'sizeof' 1>c:\boost\include

How does boost::filesystem::unique_path() resolve the need in mkstemp analogue in C++?

倖福魔咒の 提交于 2021-01-28 05:42:13
问题 An old feature request for Boost was requesting a feature similar to mkstemp POSIX function to be available in Boost.Filesystem. The issue is long closed as fixed, with the comment The unique_path() function in Version 3 addresses the problem. But I fail to see how unique_path resolves the problem. It's basically the same as tmpnam: after the name has been generated and before actual file is created, another program may have created its file with the same name. So how is it supposed to

Exception throw in boost::asio::spawn not caught by try catch

≡放荡痞女 提交于 2021-01-28 05:14:31
问题 In this convoluted example, two for loops are started by boost::asio::spawn() asynchronously. The first for loop prints an odd number every 1000us and the second one prints an even number every 1000us. I expect the output to be something like 1 2 3 4 5 6 and then the 'Throw an error' message should be printed to stderr by the call to cerr. However, the exception is actually thrown in loop.run() so it is not caught by the try catch block. Can someone point out how to properly catch the runtime