Hi,
Could anybody point me, please, what the difference is between making functor of set::insert and set::count in the below fragment?
typedef std::set<std::string> s_type;
typedef std::pair<s_type::iterator, bool>(s_type::*insert_fp)(const s_type::value_type&);
typedef s_type::size_type(s_type::*count_fp)(const s_type::value_type&);
...
Hi
I'm using boost libs for c++ and the function lexical_cast behaves really weird. If I do lexical_cast("0.07513994") it works fine, but if I use my variable which I need to convert, it throws the bad_lexical_cast exception. Here is the code:
string word;
istringstream iss(line);
do
{
string word;
iss >> word;
double ...
Inside boost there's boost::detail::addr_impl_ref struct that basically has a constructor accepting a T& reference and an overloaded operator T&() that returns that reference. It is used in the implementation of boost::addressof():
template<class T> T* addressof( T& v )
{
return boost::detail::addressof_impl<T>::f( boost::detail::ad...
In boost::detail::addressof_impl::f() a series of reinterpret_casts is done to obtain the actual address of the object in case class T has overloaded operator&():
template<class T> struct addressof_impl
{
static inline T* f( T& v, long )
{
return reinterpret_cast<T*>(
&const_cast<char&>(reinterpret_cast<const...
I recently installed the Boost Library on Windows using the installer, I'm trying to link to the library in Eclipse but am not having any luck. I tried going through Project Properties -> C/C++ Build -> Settings -> MinGW C++ Linker -> Libraries and add the reference "boost_filesystem" according to this website: http://www.ferdychristant...
I have a similar question regarding using Boost under Windows. I'm very new to Boost and I just installed the Boost library on my Mac, I'm interested primarily in the Boost Graph Library. My questions are as follows, when installing Boost by default on my Mac, is the BGL installed automatically as well? I ask this because the Boost web...
I've got a function that I want to take an optional boost::function argument as a callback for reporting an error condition. Is there some special value I can use a the default value to make it optional?
For example, with a regular function pointer I can do:
void my_func(int a, int b, t_func_ptr err_callback=NULL) {
if (error && (...
The full error I'm getting is this:
error: ambiguous overload for ‘operator[]’ in ‘a[boost::_bi::storage4<A1, A2, A3,
boost::arg<I> >::a4_ [with A1 = boost::_bi::value<MsgProxy*>, A2 = boost::arg<1>, A3 =
boost::arg<2>, int I = 3]]’
It references line 116 of a class I have, which is the boost::bind call in this function:
// Dis...
In this answer to a question asking "is doing Z this way portable" the idea is "boost does it this way, it means it is very portable".
Can I just always consult boost sources to find the most portable way of doing something in C++? How can I judge for myself if boost is really such a collection of super-portable code?
...
I just downloaded and ran the Boost installer (the one called "BoostPro 1.42.0 Installer" here). I then looked in c:\program files\boost\boost_1_42 to check everything was installed correctly, only to find a collection of zip files and nothing else. Did I do something wrong? I was hoping to see a collection of .lib files. There is a "lib...
We are working on Arabic Natural Language Processing project, we have limited our choices to either write the code in Python or C++ (and Boost library). We are thinking of these points:
Python
Slower than C++ (There is ongoing work to make Python faster)
Better UTF8 support
Faster in writing tests and trying different algorithms
C++...
Boost::GIL has almost perfect tutorial and manual. I find it troublesome to lack guide on building and using Boost::GIL work with PNG & JPEG IO. Does anyone have experience or have successfully did that? Please kindly advise! Thanks!
EDIT:
Answer lies here: http://opensource.adobe.com/wiki/display/gil/Downloads
...
hello.
I'm very new to c++ and boost.
I'm trying to get the host name of a given url:
this is what I have now:
int main()
{
string url = "http://www.amazon.com/gp/product/blabla";
//Regular Expression from Javascript.
boost::regex ex("/^((\w+):\/\/\/?)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#;\|]+)?([;\|])?([^\?#]+)?\??([^#]...
I have a C++ class(inside a dll project) whose member variables are boost::shared_ptrs to objects of other classes. Is it better to assign them inside the class constructor or have a separate init() function which does that.
I am assuming the default value of pointer to T inside boost::shared_ptr is NULL. So if I do nothing inside the ...
The Loki library implements some very widely used concepts (smart pointer, visitor, factory, etc.). The associated book "Modern C++ Design" is often mentioned, but the library itself is not widely used. Why is that?
Most developers seem to prefer Boost. In particular, why do people often decide to use Boost's smart pointers rather than ...
I am working in Linux, Eclipse CDT, g++, with Boost library. Having existing program which uses Boost thread, I try to link it statically instead of dynamically. /usr/local/lib directory contains the following files:
libbost_thread.a
libbost_thread.so
libbost_thread.1.41.0
Dynamic linking works:
g++ -o"MyProgram" ./main.o -lboost...
I just saw this nice copy-on-write pointer implementation. It looks pretty generic and useful, so my question is: Is such a class contained in any of the C++ toolkits (boost, loki, etc.)? If not, I'd really like to know why because it is a really useful idiom and apparently a generic implementation seems doable (like the one I linked to)...
I am trying to use boost's asio library, but I keep getting undefined references. I'm on Dev-Cpp on Windows, which is using the G++ compiler.
I installed boost using the installer from boostpro computing for Boost 1.42.0 [link]. Here is the code of the test program I am trying to make:
#include <boost/asio.hpp>
#include <iostream>
i...
What kind of tricks can be used to minimize the workload of implementing pImpl classes?
Header:
class Foo {
struct Impl;
boost::scoped_ptr<Impl> self;
public:
Foo(int arg);
~Foo();
// Public member functions go here
};
Implementation:
struct Foo::Impl {
Impl(int arg): something(arg) {}
// All data members...
Things to take into consideration:
- easy to use
- fast
- use underlying OS as much as feasable (like wxWidgets for UI)
Ones I am leaning towards are wxWidgets for UI and Boost for networking - how do they compare to others?
...