boost

What utf format should boost wdirectory_iterator return?

If a file contains a £ (pound) sign then directory_iterator correctly returns the utf8 character sequence \xC2\xA3 wdirectory_iterator uses wide chars, but still returns the utf8 sequence. Is this the correct behaviour for wdirectory_iterator, or am I using it incorrectly? AddFile(testpath, "pound£sign"); wdirectory_iterator iter(test...

/MT and /MD builds crashing, but only when debugger isn't attached: how to debug?

I have a small single-threaded C++ application, compiled and linked using Visual Studio 2005, that uses boost (crc, program_options, and tokenizer), a smattering of STL, and assorted other system headers. (It's primary purpose is to read in a .csv and generate a custom binary .dat and a paired .h declaring structures that "explain" the ...

How to check if socket is closed in Boost.Asio?

What is the easiest way to check if a socket was closed on the remote side of the connection? socket::is_open() returns true even if it is closed on the remote side (I'm using boost::asio::ip::tcp::socket). I could try to read from the stream and see if it succeeds, but I'd have to change the logic of my program to make it work this way...

Is it possible to use boost.any as a key in a std::map(or something similiar)?

std::map<any, string> is not working so I wonder if there's another approach to have arbritary keys? ...

how to perform boost::filesystem copy_file with overwrite

Hi, The Windows API function CopyFile has an argument BOOL bFailIfExists that allows you to control whether or not you want to overwrite the target file if it exists. The boost::filesystem copy_file function has no such argument, and will fail if the target file exists. Is there an elegant way to use the boost copy_file function and o...

how do I use STL algorithms with a vector of pointers

I have a vector of pointers that are not owned by the container. How do I use algorithms on the targets of the pointers. I tried to use boost's ptr_vector, but it tries to delete the pointers when it goes out of scope. Here is some code that needs to work: vector<int*> myValues; // ... myValues is populated bool consistent = count(my...

Qt: adapting signals / binding arguments to slots?

Is there any way to bind arguments to slots ala boost::bind? Here's a for-instance. I have a window with a tree view, and I want to allow the user to hide a column from a context menu. I end up doing something like: void MyWindow::contextMenuEvent (QContextMenuEvent* event) { m_column = view->columnAt (event->x()); QMenu menu; ...

Creating Library with backward compatible ABI that uses Boost.

I'm working on certain C++ library (or more framework). I want to make it backward compatible with previous versions preserving not only API compatibility but also ABI (like the great job Qt does). I use lots of functionality of Boost and it seems for me that this makes backward compatibility just impossible, unless I force user to have...

how do I dynamically cast between vectors of pointers?

I have: class T {}; class S: public T {}; vector<T*> v; vector<S*> w; transform(v.begin(), v.end(), dynamic_cast_iterator<S*>(w.begin())); But, of course, dynamic_cast_iterator doesn't exist. ...

Using Boost on ubuntu

I've heard a lot of good comments about Boost in the past and thought I would give it a try. So I downloaded all the required packages from the package manager in Ubuntu 9.04. Now I'm having trouble finding out how to actually use the darn libraries. Does anyone know of a good tutorial on Boost that goes all the way from Hello World to ...

Mixing Qt with STL and Boost - are there any bridges to make it easy?

Are there any bridges to make mixing Qt with STL and Boost as seamless and easy as possible? This is a followup to Mixing Qt and Boost, where no specific answers how to accomplish this were given. ...

C++ Converting a Datetime String to Epoch Cleanly

Is there a C/C++/STL/Boost clean method to convert a date time string to epoch time (in seconds)? yyyy:mm:dd hh:mm:ss ...

GCC is not linking library to a non-default path!

I have boost C++ libraries already installed on my Fedora10 machine but I want to use a newer version that I keep at some location in my home folder. I want g++ to use include and library files from my home folder location instead of default (/usr/include and /usr/lib64). For that matter, I also have declared CPLUS_INCLUDE_PATH and LIBR...

Building with Boost through Visual Studio is not picking the correct VS version or statically linked libs

#include <boost/regex.hpp> int main(void) { return 0; } Error 2 fatal error LNK1104: cannot open file 'libboost_regex-vc90-mt-gd-1_38.lib' This isn't a pathing problem. I intentionally do not have that .lib built, and want to link against the mt-sgd-1_38.lib file, but I don't know what I need to set to have boost's auto-namin...

What is the difference between static_cast and Implicit_cast?

What is implicit_cast? when should I prefer implicit_cast rather than static_cast? ...

How do you transfer ownership of an element of boost::ptr_vector?

#include <boost/ptr_container/ptr_vector.hpp> #include <iostream> using namespace std; using namespace boost; struct A { ~A() { cout << "deleted " << (void*)this << endl; } }; int main() { ptr_vector<A> v; v.push_back(new A); A *temp = &v.front(); v.release(v.begin()); delete temp; return 0; } outputs: ...

is there a way to combine Qt-Creator + Boost Library?

Hi, I was wondering if there was a way to use the boost library in Qt-creator (the IDE version of Qt). Thanks, A. ...

Is there a difference between Boost's scoped mutex and WinAPi's critical section?

The title says it all. In Windows environment, is Boost's scoped mutex using WinAPI's critical sections, or something else? ...

Copy a streambuf's contents to a string

Apparently boost::asio::async_read doesn't like strings, as the only overload of boost::asio::buffer allows me to create const_buffers, so I'm stuck with reading everything into a streambuf. Now I want to copy the contents of the streambuf into a string, but it apparently only supports writing to char* (sgetn()), creating an istream with...

[C++] Problems with boost::ptr_vector and boost::any

Hey all, ok, so I got a doubt, I want to know if this is possible: I'm using a database, with generic data (strings, ints, bools, etc...). Whenever an object is constructed or a member of an object is modified, I have to query the database with the specific action (SELECT or UPDATE). First of all, this isn't a DB related question, my r...