Boost is a large collection of high-quality libraries intended for use in C++. Boost is free, and is often considered a "second standard library".
0
votes
1answer
24 views
error: ‘template’ (as a disambiguator) is only allowed within templates
I have following definitions:
typedef boost::multi_index_container<
ModelPtr,
boost::multi_index::indexed_by<
...
0
votes
0answers
4 views
Errors in boost installed from both macport and brew
I install boost1.53 from both brew and macport. But it seems the dylib of boost installed from the two sources are put in two different directories and it really bring my trouble. I will use it for my ...
0
votes
1answer
29 views
bimap usage for repeated keys
According to the suggestion of using boost::bimap in this question, I have a question about how to solve repeated keys in bimap.
if I have:
<key1, value1>, <key1, value2>, is it possible ...
0
votes
0answers
50 views
One Writer Many Readers issue for map
I seem to be having an issue synchronizing a data collection. In this particular class, I have a data collection, mutex, and condition variable that looks something like:
map<std::string, ...
0
votes
2answers
11 views
returning a boost ublas matrix by value working only in release config for vs2012
I'm using visual studio 2012 and I isolated a problem in my code to this, but I can't solve it. When running it in release mode it works perfect, but I get an error if I run it in debug.
The code is:
...
0
votes
1answer
25 views
Boost message queues between processes that have more than a single thread (boost threads)
I develop an interactive protocol on C++ between N processes that communicate with each other via boost message_queue queues. One of the processes has 2 execution threads, a main thread that uses the ...
2
votes
1answer
47 views
error: no type named 'const_iterator' in 'class boost::asio::mutable_buffer' when trying to read using boost::asio::async_read
I am getting compiling errors using this code. It is strange because it is basically copy-paste from my another project. Any clues what could be causing this?
void Connection::asyncReceiveHeader()
{
...
2
votes
0answers
28 views
Boost program_options Can I create shorthand options with more than one character?
I am currently migrating an old application with some weird command-line arguments.
While using Boost program_options, I try to keep some of those arguments from the old version of the application, to ...
0
votes
2answers
87 views
How to use switch statements with Boost enum
I'm using the BOOST_ENUM macro and trying to write a switch statement based on a variable of the enum type I created. I get the error message that "expression must have integral or enum type"
Is ...
1
vote
2answers
34 views
boost::shared_ptr vs std::tr1::shared_ptr on multi os compilation
I have maintained different code for browser plugin(c++) for windows and mac system. The difference of the code is only for shared pointer.
In windows version I am using std::tr1::shared_ptr and on ...
1
vote
1answer
37 views
What does {error C2338: (boost::has_trivial_destructor<T>::value)} mean for boost::lockfree::queue ? What am I missing here? [duplicate]
I have a struct MyClass inside another class MyOuterClass I am trying to put into a boost::lockfree::queue. My structure looks like below
struct MyClass
{
MyClass() {}
MyClass(const ...
0
votes
1answer
29 views
Could not link boost using mingw32-g++
I'm trying to get boost::asio work.
I've built the boost with command
bjam toolset=gcc --build-type=complete --with-system --with-thre
ad --with-date_time --with-regex --with-serialization stage
...
0
votes
0answers
43 views
write in a vector through the same (ROS) callback using boost::bind (C++)
i'm using ROS topics in order to acquire some image streams from a simulator.
the idea is the following: i have "n" visual sensors and i'd like to declare n subscriber (through a for cycle) that read ...
0
votes
0answers
24 views
boost basic_managed_mapped_file with custom offset_ptr
I'd like to use boost::interprocess::basic_managed_mapped_file with custom offset_ptr, as I'm convinced that I will never exceed the range of 32bit offset, when normally offset_ptr is based on ...
3
votes
1answer
24 views
How to use a templated function as custom predicate for Boost::Unit-test
I am trying to build a custom predicate for BOOST_CHECK_PREDICATE where the predicate itself is a templated function. My example looks as follows:
#define BOOST_TEST_MODULE Module
#define ...
1
vote
1answer
63 views
How is it possible for two applications to listen on one port? [duplicate]
I'm writing several apps which communicate with network using Boost.ASIO. Suddenly two of them got the same port in config due to the mistake and both of them successfully started listening on the ...
3
votes
1answer
34 views
Boost test does not init_unit_test_suite
I run this piece of code
#define BOOST_TEST_MAIN
#define BOOST_TEST_DYN_LINK
#include <boost/test/unit_test.hpp>
#include <boost/test/unit_test_log.hpp>
#include ...
0
votes
1answer
31 views
How to shrink boost::offset_ptr
I'm using boost::interprocess::offset_ptr<> template class specialization, as a type of several fields in my structure. Unfortunately offset_ptr has a size of an underlying pointer(8 bytes in my ...
0
votes
1answer
16 views
LINK1104 cannot open boost static library using visual studio 2008 command prompt
I'm trying to compile a cpp file which uses static boost libraries. I'm using the visual studio 2008 command prompt as I have not set up a VS project file.
The command I'm using is (run from the ...
1
vote
0answers
23 views
BOOST_STRONG_TYPEDEF of 'void * const *' will not compile
The following code, written as a minimal problematic example, fails to compile:
#include <boost/serialization/strong_typedef.hpp>
BOOST_STRONG_TYPEDEF( void * const *, my_const_iterator )
int ...
2
votes
1answer
39 views
Erroneous tokenizing
I have this code:
#include <boost/tokenizer.hpp>
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
int main() {
using namespace std;
...
6
votes
2answers
68 views
boost::optional<T&> vs T*
I'm trying to understand when is the right time to use some of the structures that come with boost and had a question regarding the use of boost::optional with a reference.
Suppose I have the ...
1
vote
2answers
84 views
Why does Boost.Asio not support an Event-based interface (for example, something along the lines of condition variable signaling)?
I am attempting to understand Boost.Asio, with the intention of potentially implementing a signaling system using condition variables in conjunction with Boost.Asio.
I have seen the other ...
1
vote
1answer
23 views
Can I get log output only for failures with boost unit tests
I have some logging in my application (it happens to be log4cxx but I am flexible on that), and I have some unit tests using the boost unit test framework. When my unit tests run, I get lots of log ...
2
votes
2answers
45 views
Boost enable/disable_if function pair's order matters?
I'm writing a recursive function whose end condition is determined by template parameters. I'm using boost::enable_if and boost::disable_if to switch out the recursive function for an empty base case ...
1
vote
1answer
34 views
Boost test - every suite in other file
I have file test.cpp. It looks like this:
#define BOOST_TEST_MAIN
#include <boost/test/included/unit_test.hpp>
BOOST_AUTO_TEST_SUITE( test_suite1 )
BOOST_AUTO_TEST_CASE( my_test )
{
// ...
2
votes
1answer
61 views
Boost.Spirit.Qi: dynamically create “difference” parser at parse time
A "difference" parser can be created by the binary -(minus) operator:
rule = qi::char_ - qi::lit("}}")
or even compound differences:
rule = qi::char_ - qi::lit("}}") - qi::lit("]]")
But how ...
2
votes
1answer
46 views
boost pool: can I wean it from boost system?
The documentation for pool in 1.53.0 claims that it is 'header-only'. However, a minimal program:
#include <boost/pool/pool_alloc.hpp>
int main() {
return 0;
}
ends up with undefined ...
1
vote
1answer
61 views
Using boost libraries in Qt
Some days ago i compiled boost ver. 1_53_0 for vs2012, works fine, compiles fine. Now i want to use boost with Qt creator. In the .pro file i've included
INCLUDEPATH += C:\boost\boost_1_53_0\ ...
0
votes
0answers
52 views
C++ factory using non-default constructor - can I avoiding casting?
I am implementing deserialization of XML (and later binary) format to an inheritance hierarchy. I want to create the objects in the tree using this (syntactically-incorrect) constructor (which accepts ...
1
vote
0answers
28 views
boost::signals2 and exception handling
Is there some way to override the specific moment when a slot is called in boost::signals2 and perform some actions (logging, debugging, exception handling)?
I would like to catch exceptions at the ...
0
votes
1answer
84 views
Iterator for vector values in a std::map
I have a class containing a map that stores vectors of shared_ptr objects.
#include <map>
#include <memory>
#include <vector>
template <class T, class U>
class MyMap {
...
1
vote
2answers
63 views
Understanding vector<shared_ptr<T> >, shared_ptr<vector<T> >, or vector<T>
The Node is the data structure used to store the Node when we parse a graph.
Here is the sample code:
struct NodeA {
vector<string> vecStrs; // the size of the vecStrs keeps increasing!
};
...
5
votes
4answers
165 views
algorithm to add values of two ranges and place them into a third one
I was just wondering if there was anything (either in c++11 or boost) that could help me do something like this:
std::vector<int> v1 = {1, 2, 3};
std::vector<int> v2 = {2, 5, 4};
...
0
votes
0answers
42 views
c++: use boost range transformed adaptor with binary function
Suppose I have two std::vectors x and y and a binary function F. I would like to create a new object z (not necessarily a vector), with the property that the ith elemenent of z will be the application ...
0
votes
4answers
64 views
How to access a private member inside a static void* function
File:Service.hpp
class Service
{
private:
boost::unordered_map<std::string,int> m_mapModuleType2FD;
void ProcessRequest();
public:
static void* KeepAlive(void* arg);
...
2
votes
2answers
68 views
Boost linker errors when using header only libraries
I am using the following components of boost 1.53.0 in conjunction with C++11 libs . . .
boost::signals2::scoped_connection
boost::signals2::signal
boost::signals2::connection
...
1
vote
0answers
49 views
boost::shared_ptr and Return Type Resolver idiom
I am currently working on a concept of Object known in Java or C# for C++. It would be similar to variant type like boost::any, however having wider functionality. For that purpose I am using ...
2
votes
1answer
25 views
Boost io_service.accept : Get URI called
I would like to get the URI called with boost.
If http://localhost:8080/users/4 is called, I want to know the URI or just /users/4
#include <boost/bind.hpp>
#include <boost/asio.hpp>
...
2
votes
1answer
33 views
Boost asio “network connection was aborted by local system” on async_read_some
I'm having an issue creating a really simple TCP based server-client connection using boost asio. When I get a connection from a client on my server and get into the method that handles the ...
1
vote
0answers
19 views
How to convert images from cv::Mat to boost::gil::rgb8c_view_t
Does anyone know how to convert images from cv::Mat to boost::gil::rgb8c_view_t? I found one solution by others, which is basically like this:
template <typename DestView>
DestView ...
0
votes
1answer
18 views
How to set a dynamic task as a defaultTask
Sorry for the newbie question, but I have yet to see an example or question related to specifying dynamic tasks as a defaultTask in a gradle project.
So, how do I specify the dynamic $boostLibName ...
1
vote
2answers
28 views
Need help to build Boost from source for MinGW
I was trying to build Boost library from source for MinGW. The Boost website says no guarantee but there seem to be people done it successfully. However I couldn't find much instructions on the web.
...
-3
votes
0answers
38 views
TLV based client/server communication protocol [closed]
My need is to define a client/server communication protocol, and I think TLV would a light and straight way to achieve this compared to some heavy things like CORBA.
So I've searched the web ...
6
votes
1answer
158 views
Can I check that a class is *not* default constructible?
First of all, note that I'm using C++03 (and C++11 is not an option). I'm using boost concept to check that a certain class is default-constructible:
...
-1
votes
1answer
45 views
replacing scoped_array with non-contiguous memory in C++
I have a C++ class which is something like
class Block {
...
scoped_array<Columns> columns_
...
}
Now as i understand because of using an array, the memory for Columns array will be ...
0
votes
1answer
20 views
Template Specialization on boost handlers for the boost tcp connection example
I have a data path that follow this order: handle_connect -> setup_listen -> handle_read -> setup_listen -> handle_read -> setup_listen, and so on, looping between handle_read and setup_listen.
...
0
votes
1answer
31 views
Can boost:algorithm::join() concat a container of floats?
Boost join can be used to concatenate a container of strings optionally separated by a separator string. In this stackovwerflow example: A good example for boost::algorithm::join
My STL skills are ...
0
votes
1answer
60 views
Reducing my boost lib folder
Even having already dug through loads of info on the net about this, I am still having some trouble understanding the boost lib files. I have Boost 1.51 installed and the lib folder is 1.7GBs which is ...
0
votes
2answers
50 views
using boost::function to save function pointer to arbitrary object's member functions
I am trying to store a member function from an object to call it when an appropriate event happens. Unfortunately this code gives a lot of error messages. Can anybody help me?
class MainPage
{
...