I am playing around with the boost strings library and have just come across the awesome simplicity of the split method.
string delimiters = ",";
string str = "string, with, comma, delimited, tokens, \"and delimiters, inside a quote\"";
// If we didn't care about delimiter characters within a quoted section we could us
vector<s...
Hi everyone!
I've recently got acquainted with Boost library and I'd like to use it in my Xcode project. But sadly there is no HowTo or FAQ on how to do it :(
What's the sequence of actions to build and use Boost libraries in Xcode?
Thanks in advance :)
...
For a school assignment I have to implement a project in C++ using Borland C++ Builder.
As the VCL uses AnsiString for all GUI Components I have to convert all of my std::strings to AnsiString for the sake of displaying.
std::string inp = "Hello world!";
AnsiString outp(inp.c_str());
works of course but is a bit tedious to write and ...
Hi all,
I'm making a neural network and wanted to use a hash_map to keep weight references for output neurons for each neuron:
class Neuron; //forward declaration was there (sorry I forgot to show it earlier)
typedef double WEIGHT;
typedef stdext::hash_map<boost::shared_ptr<Neuron>,WEIGHT> NeuronWeightMap;
class Neuron
{
private:
N...
Hello all :)
I was using Boost 1.38, and I just upgraded to 1.39. Upgrading broke the following bit of code:
std::vector<std::wstring> consoleParser::loadStringsFromFile(const std::wstring &fileName)
{
std::vector<std::wstring> files;
std::wstring fileString(loadFileAsString(fileName));
boost::algorithm::split(files, fileSt...
is there any function in C++ that calculates a fingerprint or hash of a string that's guaranteed to be at least 64 bits wide?
I'd like to replace my unordered_map<string, int> with unordered_map<long long, int>.
Given the answers that I'm getting (thanks Stack Overflow community...) the technique that I'm describing is not well-known. ...
Maybe its a very dumb question but I hope you can give me some answers.
I have a commercial application which uses Qt3 for its GUI and an embedded Python interpreter (command line) for scripting. I want to write a custom plugin for this application which uses Qt4. The plugin is mainly a subclassed QMainWindow-class that is linked into a...
Let's say I have 3 classes. I expect sizeof() each class to be exactly the same--say 512 bytes.
How can I use something like BOOST_STATIC_ASSERT to apply to all of them such that
I only need to use BOOST_STATIC_ASSERT in a single place (DRY principle)
Evaluated once at compile-time and not run-time
Note: we can use whatever C++ tech...
I am following the quickstart guide for boost::spirit, and I get this compiler warning when I include : "This header is deprecated. Please use: boost/spirit/include/classic_core.hpp" Should I be worried about this?
(quick start guide: http://spirit.sourceforge.net/distrib/spirit_1_8_5/libs/spirit/doc/quick_start.html , with full source...
I'm looking for POD low dimension vectors (2,3 and 4D let say) with all the necessary arithmetic niceties (operator +, - and so on). POD low dimension matrices would be great as well.
boost::ublas vectors are not POD, there's a pointer indirection somewhere (vector are resizeable).
Can I find that anywhere in boost? Using boost::array ...
I have a priority queue of events, but sometimes the event priorities change, so I'd like to maintain iterators from the event requesters into the heap. If the priority changes, I'd like the heap to be adjusted in log(n) time. I will always have exactly one iterator pointing to each element in the heap.
...
I need to design a data structure that supports the following operations:
search element in the data structure based on a key that is an interval. For example the value within interval 1-5 may be 3, from 6-11 may be 5 and so on. The intervals are contiguous and there is no overlap between them.
find previous and next interval - this i...
Hello!
Consider following example:
#include <iostream>
#include <functional>
#include <algorithm>
#include <vector>
#include <boost/bind.hpp>
const int num = 3;
class foo {
private:
int x;
public:
foo(): x(0) {}
foo(int xx): x(xx) {}
~foo() {}
bool is_equal(int xx) const {
return (x == xx);
}
void...
Hi,
i have alot of spin locks in my multithread code and most of the time they are waiting for other threads to do work and thus chew alot of cpu usage. In linux i normally use pthread_cond_wait and pthread_cond_signal to pause a thread and wake up when signaled. Is there something like this in the boost libraries? Having a quick look i...
Hello!
Is there a way to check at compile time if some class has constructor with certain arguments ?
?
For example:
class foo {
foo(std::string &s) {
}
};
I want to check at compile time that constructor with std::string& always defined. Maybe boost provides such functionality ?
...
I'm looking for recommendations for open-source projects written in C++ that will help me "get my chops back". A little background:
I've been working heavily in Java for the last three years, doing a lot of back-end development and system design, but with a fair amount of work in the presentation layer stuff, too.
The last C++ project...
Does there exist a collection, that is aware of shared_ptr internals, and avoids regular copying of stored shared_ptr elements in favor of just copying their internal weak pointer?
This implicitly means, that no constructor/destructor calls will be done and that there will be no manipulation of shared_ptrs' reference counters.
...
I'm using Boost but I cannot find complete (or good) documentation about the filesystem library in the installation directory nor the web. The "-ls" example I found has been quite a helper but it's not enough.
Thanks in advance :)
...
Considering these two structs:
struct point {
int x,y;
};
struct pinfo {
struct point p;
unsigned long flags;
};
And a function, that changes a point:
void p_map(struct point &p);
Is it possible to use boost (e.g. boost::bind or boost::lambda) to create a function equivalent with:
void pi_map(struct pinfo &pi) { p_map...
I am trying to start unit testing. I am looking at a few C++ frameworks and want to try Boost.Test. The documentation seems very thorough, and it's a bit overwhelming, especially someone new to unit testing. So here's a situation that I want:
Let's say I have 2 classes, Foo and Bar. I want to write a suite of tests for Foo and a suite o...