I want to iterate over all files in a directory matching something like "somefiles*.txt". Does boost::filesystem have something built in to do that, or do I need a regex or something against each leaf()?
...
My application converts past and present dates from local time to UTC.
I need to ensure I will honor any future DST updates to Windows while still correctly handling past dates.
The application is written in C++ and is running on Server 2003.
Options I've researched:
gmtime() and localtime() are not always correct for past dates bec...
Hello experts
I have been trying to emulate a copy_if by the following codes but my compiler (g++-4.0) just keeps complaining. What's technically wrong? Thanks for your help!
template <class STL> // a std container of class A, but I don't know if it's a list or vector or deque
void export_(STL& Alist) { //a member function
for_each(Al...
BOOST_FOREACH is really neat, but the C macro style of writing is somewhat off-putting.
Is there a trick to avoid the all-caps spelling?
...
I just started using Boost::regex today and am quite a novice in Regular Expressions too. I have been using "The Regulator" and Expresso to test my regex and seem satisfied with what I see there, but transferring that regex to boost, does not seem to do what I want it to do. Any pointers to help me a solution would be most welcome. As a ...
I have a simple struct :
struct MyType
{
std::string name;
std::string description;
}
and I'm putting it in a shared memory :
managed_shared_memory sharedMemory(open_or_create, "name", 65535);
MyType* pType = sharedMemory.construct<MyType>("myType")();
// ... setting pType members ...
If the two applications communicating w...
I have a situation where a boost::function and boost::bind (actually a std::tr1::function and bind) are being deleted while still in use. Is this safe? I would normally avoid it, but the offending code is a bit entrenched and my only other option is adding a new thread.
typedef function<int(int)> foo_type;
foo_type* global_foo = NULL...
I have three legacy applications that share a lot of source code and data. Multiple instances of each of these applications be executed by a user at any time, e.g. a dozen mixed application executions can be active at a time. These applications currently communicate through shared memory and messaging techniques so that they can maintain...
I am using BOOST_FOREACH to iterate through the characters of a C++ string like this:
void foobar(const string& str)
{
BOOST_FOREACH(const char ch, str)
{
// Do something with ch
}
return;
}
This piece of code works fine with the following compilation modes:
Multi-threaded (Release) (/MT)
Multi-threaded Debu...
Hi,
I'm trying to set up a timer using the boost library.
Basically, this is what I wrote:
class ContactList {
public:
ContactList();
virtual ~ContactList();
int Start();
int readFromFile();
int dumpList();
void checkContacts(const boost::system::error_code& error);
void initializeTimer();
private:
std...
What is the difference between Boost::bind and Boost Phoenix::bind?
...
I'm trying to use Boost::bind and std::copy to print out the values in a list of lists. Obviously, I could use loops, and I may end up doing so for clarity, but I'd still like to know what I'm doing wrong here.
Here is the distilled version of my code:
#include <boost/bind.hpp>
#include <iterator>
#include <algorithm>
#include <list>
...
I'm using phoenix::bind and receiving this error message:
error C2039: 'bind' : is not a member
of 'phoenix'
The code line where I'm using bind and where the error is pointing is:
phoenix::bind(
&OptionalInputPort::eraseDataEditor )
( phoenix::var( *optionalPort ) )
and I can't figure out what is the pro...
I'm getting a lot of errors compiling code using the boost libraries, mainly when I'm using Spirit namespace. The errors are syntax errors on boost files like:
boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C2143: syntax error : missing ';' before '<'
or
boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C4430: miss...
Is there a non-hacky (i.e. no assembly, ...) way to use boost functions to create callbacks with non-static class methods?
Currently for static methods:
list<function<void (LuaState&)> > _callbacks;
I was thinking something along the lines of
list<tuple<function<void (void *, LuaState&)>, void*> _callbacks;
but boost functions doe...
UPDATE: Found a way to make it compile, see below.
Hello, I'm having issues compiling boost programs under cygwin. I've installed the default boost and g++ packages from the cygwin project's setup.exe.
On my Linux systems, I can compile a program reg.cpp using the following:
g++ -I/usr/include/boost -lboost_regex -o reg reg.cpp
On c...
Hi,
I am trying to run blocking_udp_echo_server.cpp from Boost asio example on MacOSX 10.5.
But it crashes:
From the console:
/Developer/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/debug/safe_iterator.h:127:
error: attempt to copy-construct an iterator from a singular iterator.
Objects involved in the operation:
iterator "this" @ 0...
Hello everyone.
For some reason, I cannot get ptr_list to insert elements.
boost::ptr_list<int> somelist;
int *someint = new int(123);
int *someint2 = new int(456);
somelist.push_back(someint);
boost:: ptr_list<int>::iterator i = somelist.begin();
somelist.insert(i,someint2);
Any help, please?
...
I have to update an application to use Boost 1.34 instead of 1.37, and it's causing me a ton of trouble.
One of the biggest problems at the moment is that I don't know Boost threads very well. With 1.34, I get...
error C2039: 'this_thread' : is not a member of 'boost'
...for the code
boost::this_thread::sleep(boost::posix_time::mill...