1

Closed

boost::bind conflicts w/ pstsdk

description

file pstsdk/ltp/object.h has method
template<>
inline std::vector<bool> pstsdk::const_property_object::read_prop_array<bool>(prop_id id) const {...}
 
which is use std::bind. this fact make impossible to work w/ some boost libs which are implicitly include boost::bind (I'm talking about c++0x mode) cuz both libs are trying to put placeholder objects into the same namespace.
 
cuz README recommends minimum required GCC version as 4.4 native c++0x lambdas could be used instead (and will produce petter optimized code btw):
std::transform(values.begin(), values.end(), results.begin(), [](const ulong v) -> bool { return v != 0; });

file attachments

Closed Aug 12, 2011 at 3:03 PM by terrymah
Boost issue, not a PSTSDK issue

comments

terrymah wrote Aug 12, 2011 at 12:18 AM

I'm not sure I follow - I use pstsdk in projects with boost (although not boost::bind, since std::bind has been available for a while). What errors are you seeing? I'm aware of any namespace issues; std placeholders are in std::placeholders and boost's are just in boost, I think. It sounds like this might be a boost issue, not a pstsdk issue.

I can't use lambdas because it was decided to try and support non-C++0x compilers (VC9, old gccs) a while back. I pulled all the lambdas out and made the rvalue reference overloads optional.

wrote Aug 12, 2011 at 11:02 AM

zaufi wrote Aug 12, 2011 at 11:02 AM

this test program failed to compile by gcc 4.5.3:

include <boost/bind.hpp>

include <pstsdk/pst.h>

int main()
{
return 0;                                                                                                                                          
}

terrymah wrote Aug 12, 2011 at 3:03 PM

I see what you mean, boost is putting their placeholders in the global namespace. This is a Boost issue. See https://svn.boost.org/trac/boost/ticket/2240. As a work around, I suggest you use std::bind instead of boost::bind.

wrote Aug 12, 2011 at 3:03 PM

terrymah wrote Aug 12, 2011 at 3:12 PM

Also, just reversing the order of your includes (include pstsdk/pst.h first) might be an easy work around.

wrote Feb 14, 2013 at 8:08 PM

wrote May 16, 2013 at 9:40 AM