This project is read-only.


boost::bind conflicts w/ pstsdk


file pstsdk/ltp/object.h has method
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 4:03 PM by terrymah
Boost issue, not a PSTSDK issue


terrymah wrote Aug 12, 2011 at 1: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 12:02 PM

zaufi wrote Aug 12, 2011 at 12:02 PM

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 4:03 PM

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

wrote Aug 12, 2011 at 4:03 PM

terrymah wrote Aug 12, 2011 at 4: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 9:08 PM

wrote May 16, 2013 at 10:40 AM