tuple in boost and TR1/c++0x provides a convenient (for the writer of the function) method to return two values from a function--however it seems to damage one major feature of the language for the caller: the ability to simply use the function to initialize a variable:
T happy();
const auto meaningful_name(happy()); // RVO means no exc...
I want to transform a vector of type T to a vectorof type K.
I tried this, but it doesn't work:
transform(vec.rbegin(),vec.rend(),vecNew.begin(),boost::bind(static_cast<K>(),_1));
I get the error: "expected primary-expression before ‘)’ token". What am I doing wrong?
...
Okay so I have the following makefile
CC = g++
#CFLAGS = -g -Wall
CFLAGS = -g
LDFLAGS = -lm
#client : shared.lib
#server : shared.lib
shared : src/shared/opcode.h
$(CC) $(CFLAGS) -I./src/ -I./lib/boost/ -L./lib/boost/stage/lib/ -L./lib/win_sdk/ \
-D_WIN32_WINNT=0x0501 \
-lWS2_32 \
-lboost_system-mgw34-mt-1_43 \
-lboos...
I have to build Boost outside the "usual" directory tree (i.e., /custom/dir instead of /usr), which is not that much of a problem: Just pass --prefix=/custom/path to ./runscript.sh / ./bjam, and there you go.
Or so I thought.
The problem is that some of the Boost libraries depend on each other, and - using the default build process goi...
I am trying to create a Stream_Handle for a harddisk device. Here is the piece of code.
ntStatus = NtCreateFile(source, DesiredAccess, &oa, &ios, NULL, FileAttributes, ShareAccess,
CreateDisposition, CreateOptions, NULL, 0);
//Create ReadStream
boost::asio::io_service io_service;
boost::asio::windows::stream_handle...
EDIT: I should've mentioned, I was looking at the documentation for Boost's ptr_sequence_adapter and it claims that their adapter for template< class U > void push_back( ::std::auto_ptr<U> x ); is equivalent to doing vec.push_back(autoPtr.release()); and also provides the strong exception guarantee. And then I realized I was confusing t...
Hey,
I'm using boost::iostreams::gzip_decompressor with boost::iostreams::filterimg_streambuf to read gzip files.
some of my files have what zcat calls trailing trash
% zcat somefile
data
data
data
gzip: somefile: decompression OK, trailing garbage ignored
What I want is for boost gzip to behave the same way.
When trying to decom...
I'm using Boost.Property_Tree for a project and I want to add a small bit of functionality to it. I want to add a "fromFile" static member variable that will figure out the file type and then use the proper parser. In my project, this is currently how I've got it.
typedef boost::property_tree::ptree ConfigNode;
Then I have another cla...
C++ Boost has Bimap container that is a bidirectional map:
http://www.boost.org/doc/libs/1_43_0/libs/bimap/doc/html/index.html
Does anyone know the performance of Boost::bimap? I mean what's the time complexity of accessing an element in the map? Is it as quick as unordered_map access (which is O(1))?
Thanks!
...
I tried to declare a memory pool in my class.
But the compiler shows some basic error like missing ')' before ';'
or syntax error : 'sizeof'
It works well if I used the pool as local variable but I really want to make it live with the class.
What's wrong about my usage?
Here is the class, the MAX_OBJ is a const
class CData
{
publi...
From this post I see that you can't overload operators for pointers: http://stackoverflow.com/questions/1419997/c-operator-overloading-of-for-pointers-to-objects
But is there any way I could overload operators for boost pointers? For example:
boost::shared_ptr<ClassB> operator||(boost::shared_ptr<ClassA> lhs, boost::shared_ptr<ClassA...
Hello,
I would like to know whether there is any way to check the validity of a boost call back function.
Issue is as follows
class A;
class B;
In class A's initialise function following is done.
boost::function < void(class B) > call_back;
using namespace boost::lambda;
call_back = bind(&A::callback_after_preparation, this, boos...
Hi,
i have to parallize some code and a fried of mine suggested using boost for it. Right now i have a look into openMP and i am wondering what you think is better for that task.
...
I have been asked by one of my potential employers to undertake a brainbench test for Boost (position is for C++ programmer). I have never heard/seen a brainbench test for Boost. Brainbench's website also doesn't have any hint. I was wondering perhaps it is some sort of customized solution for employers.
My question, however is, what ca...
I am looking to convert a boost::uuid to a const char*. What is the correct syntax for the conversion?
...
Hi,
I created a simple .so library containing definition of a C++ class which should be accessed from Python and used for this purpose boost python library.
When I'm testing this library using x64 Ubuntu it is enough to set LD_LIBRARY_PATH with the path to boost libs before running python. It doesn't work, however, when I'm using x64 Sus...
I'm trying to build the open source project VMWare open view client. The problem I'm having is I can build it following their instructions however my build does not include all the depedencies and thus when I go to deploy it there is a failure saying missing libboost_signals-gcc41-1_34_1.so.1.34.1. According to their forums someone sug...
Is it somehow possible to use boost::object_pool<>::construct with non const references?
The following snippet doesn't compile (VS2010):
foo::foo(bar & b)
{
}
static boost::shared_ptr<foo> foo::create(bar & b)
{
return boost::shared_ptr<foo>(foo_pool.construct(b),
boost::bind(& boost::object_pool<foo>::destroy, & foo_pool, _1));...
Hi,
I am trying to implement a handy data repository or
knowledge base for a little program of mine.
I use a std::map of boost::any's to hold various pieces of
information. For debugging and safety purposes, I have
an extra safe accessor ''getVal()'' for the data.
A snippet says more than a thousand words:
EDIT: <<< Old snippet replac...
When I try to use boost on an old Linux system, I get the message:
Compiler not configured - please reconfigure
The version of my gcc is:
gcc version 2.9-gnupro-99r1
And in boost's gcc.hpp file I see:
// versions check:
// we don't know gcc prior to version 2.90:
#if (__GNUC__ == 2) && (__GNUC_MINOR__ < 90)
# error "Compile...