I have been using a using a boost tuple as the value in an STL map.
Up until now, I only had to construct the tuple and insert into the map and at a later stage retrieve the values.
Now I need to be able to change the tuple in the map. Is this possible, or have I run into the one place you should'nt be using tuples instead of structs.
...
I am trying to use filenames as the key in boost::PropertyTree
However, the '.' character in a filename such as "example.txt" causes an additional layer to be added within the property tree. The most obvious solution would be to replace '.' with another character, but there is likely a better way to do this, such as with an escape char...
I have the following problem.
I have two classes, in this case A and B, which both own a concurrent_queue. The assumption here is that concurrent_queue is a thread-safe queue, with a blocking push() function. When an object is enqueued in B, it accesses the singleton A and it is queued up in A as well. This has the effect that a whole b...
If I create a bunch of elements in a boost::ptr_list container how can I remove individual pointers from it? Say I do this:
boost::ptr_list intlist;
int *i = new int(3);
intlist.Add(i);
int *i2 = new int(1);
intlist.Add(i2);
int *i3 = new int(6);
intlist.Add(i3);
How can I remove say i3 and not i or i2 from the list?
...
I need to do something like this for my program's input:
stream input;
if (decompressed)
input.open(filepath);
else {
file_descriptor=_popen("decompressor "+filepath,"r");
input.open(file_descriptor);
}
input.read(...)
...
I can see 1 solution... to use _popen in both cases and just copy the file to stdout if it's already ...
Is it valid to develop a DLL in C++ that returns boost shared pointers and uses them as parameters?
So, is it ok to export functions like this?
1.) boost::shared_ptr<Connection> startConnection();
2.) void sendToConnection(boost::shared_ptr<Connection> conn, byte* data, int len);
In special: Does the reference count work across DLL b...
Hello,
I'm trying to work with lambda's in C++ after having used them a great deal in C#. I currently have a boost tuple (this is the really simplified version).
typedef shared_ptr<Foo> (*StringFooCreator)(std::string, int, bool)
typedef tuple<StringFooCreator> FooTuple
I then load a function in the global namespace into my FooTuple...
When using Boost Filesystem's createdirectory (and createdirectories) function in the following example, "/" is being replaced with "\".
boost::filesystem::path path ("/data/configSet");
boost::filesystem::create_directory(path);
This code snipped produces a directory called "data\configSet", instead of creating a subdirectory of "con...
Hi,
I'm currently working on adding exceptions and exception handling to my OSS application. Exceptions have been the general idea from the start, but I wanted to find a good exception framework and in all honesty, understand C++ exception handling conventions and idioms a bit better before starting to use them. I have a lot of experien...
Hi,
i defined boost::multi_array with
typedef boost::multi_array<unsigned int, 1> uint_1d_vec_t;
typedef boost::multi_array<unsigned int, 2> uint_2d_vec_t;
uint_1d_vec_t foo( boost::extents[ num_elements ] );
uint_2d_vec_t boo( boost::extents[ num_elements/2 ][ kappa ] );
were num_elements/2 ist an integer number...
hello
Is there C++ equivalent for python Xrange generator in either STL or boost?
xrange basically generates incremented number with each call to ++ operator.
the constructor is like this:
xrange(first, last, increment)
was hoping to do something like this using boost for each:
foreach(int i, xrange(N))
I. am aware of the for loo...
I understand that when we insert values into the STL map, a copy is made and stored.
I have code that essentially does a find on the map and obtains an iterator.
I then intend to use the iterator to change the value in the map.
The results are not what I would expect ie: the value is not changed when accessed from another part of the pr...
Since boost is forbidden in a company I work for I need to implement its functionality in pure C++. I've looked into boost sources but they seem to be too complex to understand, at least for me. I know there is something called static_assert() in the C++0x standart, but I'd like not to use any C++0x features.
...
Hi. When I try to compile this:
#include <boost/fusion/container/map.hpp>
#include <boost/mpl/fold.hpp>
int main(int argc, char** argv)
{
typedef boost::fusion::map
<
boost::fusion::pair<int, const char*>,
boost::fusion::pair<long, char>
> FuMap;
FuMap fuMap("hello", 'w');
unsigned val = boost::mpl...
I was just going over the asio example here:
http://www.boost.org/doc/libs/1%5F39%5F0/doc/html/boost%5Fasio/example/chat/chat%5Fserver.cpp
My question is about their usage of the io_serice.run() function.
The documentation for the io_service.run() function says:
"The run() function blocks until all work has finished and there are no mo...
Hi,
I have compiled and installed my boost library in '/media/data/bin' in ubuntu 9.10.
And I have setup the INCLUDE_PATH, LIBRARY_PATH env:
$ echo $INCLUDE_PATH
/media/data/bin/boost/include:
$ echo $LIBRARY_PATH
/media/data/bin/boost/lib:
But when I compile the asio example, I get the following error:
$ g++ blocking_tcp_echo_server...
I have a class which contains a few boost::numeric::ublas::matrix's within it. I would like to overload the class's operators (+-*/=) so that I can act on the set of matrices with one statement.
However this seems to require temporary instances of my class to carry values around without modifying the original class. This makes sense...
Using boost::mpl, I can create a typedef of a three element vector like follows:
typedef boost::mpl::vector_c<int,1,2,3> height_t;
I can pull the values out of this typedef with the following snippit:
std::vector<int> height;
boost::mpl::for_each<height_t>(boost::bind(&std::vector<int>::push_back, &height, _1));
assert(height[0] ...
I'm in the process of implementing a platform independent wrapper for dynamically loaded libraries. Of course when I load functions from the libraries I need to store them as pointers for future use. I thought of using boost::function's for that instead of normal function pointers. Sure, that will increase compile time, but that's not wh...