I've done enough Googling to know that if I have something
like
class SubObject {
public:
//blah blah blah
};
class Aggregate {
public:
boost::shared_ptr<SubObject> m_ptr;
};
I can get Doxygen to create the "correct" collaboration diagram
if I have a dummy declaration like
namespace boost { template<class T> class shared_ptr {...
I want to move certain element from a to b:
boost::ptr_vector<Foo> a, b;
// ...
b.push_back(a.release(a.begin() + i)));
The above code does not compile because the release function returns boost::ptr_container_detail::static_move_ptr<...>, which is not suitable for pushing back.
How should I proceed?
EDIT: I found out that the objec...
Hello all,
I'm looking for a method or a way to generate a list of typedefs and a list of object instantiations from a list of macro-invocations, defining the class types and the constructor parameters of these objects.
It should look like the (not working) code below. The problem to solve is a way to generate to different lists out of...
In my C++ library I have a type boost::variant<A,B> and lots of algorithms getting this type as an input. Instead of member functions I have global functions on this type, like void f( boost::variant<A,B>& var ). I know that this can also be achieved with templates, but this is not suitable for my design.
I am very fine with this style ...
I am wondering if there is any benefit to getting a reference to a vector prior to calling
BOOST_FOREACH or whether a method call which returns a reference will be automatically used? For example which of the two following loops will be equivalent to the third loop?
vector<float>& my_method();
void main()
{
// LOOP 1 -------------...
When compiling a Visual Studio 2005 project that references a mix of c++ managed/unmanaged code, I get the following error:
1>LINK : fatal error LNK1104: cannot open file 'libboost_date_time-vc80-mt-1_42.lib'
I have followed the "Getting Started Guide" at http://www.boost.org/doc/libs/1_42_0/more/getting_started/windows.html. Of relev...
In the following code:
tcp::socket socket(io_service);
tcp::endpoint ep(boost::asio::ip::address::from_string(addr), i);
socket.async_connect(ep, &connect_handler);
socket.close();
is it correct to close the socket object, or should I close it only in the connect_handler(), resort to shared_ptr to prolong the life of of the socket...
Hi, gents:
I am now hacking an old C code, try to make it more C++/Boost style:
there is a resource allocation function looks like:
my_src_type* src;
my_src_create(&src, ctx, topic, handle_src_event, NULL, NULL);
i try to wrap src by a shared_ptr:
shared_ptr<my_src_type> pSrc;
I forgot to mention just now. I need to do this as a ...
Hello,
I'm trying to learn about condition variables and how to use it in a producer-consumer situation. I have a queue where one thread pushes numbers into the queue while another thread popping numbers from the queue. I want to use the condition variable to signal the consuming thread when there is some data placed by the producing th...
I'm testing a C++ class with a number of functions that all have basically the same form:
ClassUnderTest t;
DATATYPE data = { 0 };
try
{
t.SomeFunction( &data );
}
catch( const SomeException& e )
{
// log known error
}
catch( ... )
{
// log unknown error
}
Since there's a lot of these, I thought I'd write a function to do...
Hello all,
I am using the boost::spirit parser. At one point when I use real_p, the value coming out of the parser stack is 38672000 instead of the actual value, 386731500. Some how it is considering it as a float value, I think. Is there anyway to fix this? Do I need to set the precision of real_p, or am using real_p in the wrong conte...
I'm trying to use Boost regex to see if something has an integer in it.
One of the examples on this page is
bool validate_card_format(const std::string& s)
{
static const boost::regex e("(\\d{4}[- ]){3}\\d{4}");
return regex_match(s, e);
}
There's also a presumably working example here.
But when I try it on my machine, I get f...
What's the best way to make a function that has pointer as argument work with boost python?
I see there are many possibilities for return values in the docs, but I don't know how to do it with arguments.
void Tesuto::testp(std::string* s)
{
if (!s)
cout << " NULL s" << endl;
else
cout << s << endl;
}
>>> t.testp...
I am using autoconf to detect boost libraries, with the support of the autoconf-archive macros and they work fine with system-wide boost libraries, but fail if I manually compile boost in my home directory:
sb@stephane:~/devel/spectra2$ ./configure --with-boost=/home/sb/local/
checking for a BSD-compatible install... /usr/bin/install -c...
Hi,
I've been trying to use smart pointers to upgrade an existing app, and I'm trying to overcome a puzzle. In my app I have a cache of objects, for example lets call them books. Now this cache of books are requested by ID and if they're in the cache they are returned, if not the object is requested from an external system (slow operati...
i need an mpl::equal like procedure that supports recursion on types.
namespace mpl = boost::mpl;
BOOST_MPL_ASSERT(( mpl::equal<
mpl::vector<int, char>,
typename mpl::push_back<mpl::vector<int>, char>::type > )); // OK
the above compiles fine, however if i use it in mpl::transform or mpl::fold, visual studio 2010 rc1 complains.
...
I'm trying to update a random-access binary file using the std::iostream interface with separate get/put positions managed via seekg/seekp. Everything works fine with stringstream, but when I create a file descriptor-based stream using Boost.Iostream (specifically boost::iostreams::stream<boost::iostreams::file_descriptor>), the get/put ...
I have a certain boost::filesystem::path in hand and I'd like to append a string (or path) to it.
boost::filesystem::path p("c:\\dir");
p.append(".foo"); // should result in p pointing to c:\dir.foo
The only overload boost::filesystem::path has of append wants two InputIterators.
My solution so far is to do the following:
boost::fil...
Hi,
For legacy reasons I need to use intrusive pointers, as I need the ability to convert raw pointers to smart pointers.
However I noticed there is no weak intrusive pointer for boost. I did find a talk about it on the boost thread list, however nothing concrete.
Does anyone know of a thread safe implementation of weak intrusive poin...
I know there are a few similar questions, but I don't think they really have the same requirements as mine.
Our DLL is compiled with Visual Studio 2005 and must link with a specific version of the CRT, due to installation constraints. This is absolute, recompiling it with the latest version is not a solution.
We recently updated our Bo...