Using lambda bind as destruct functor to shared_ptr
Hello,
Should the following code sample work? It is the simplest reproduction
case I
could come up with:
#include ::get_deleter(const
std::type_info&) [with P = void*, D =
boost::lambda::lambda_functor
Scott French wrote:
Hello,
Should the following code sample work? It is the simplest reproduction case I could come up with:
#include
#include #include #include using namespace std; using namespace boost; using namespace boost::lambda;
int main(void) { void * myResource = malloc(5); shared_ptr<void> mySharedResource(myResource, bind(free, _1)); }
I get a compile error using g++ 4.0.1 on Mac OS X:
...
My personal opinion is that overloading unary & is evil. My professional
opinion is that the code should work. :-) Please apply the following patch
(already in CVS):
diff -u -r1.4 sp_counted_impl.hpp
--- boost/detail/sp_counted_impl.hpp 11 Nov 2005 21:06:08 -0000 1.4
+++ boost/detail/sp_counted_impl.hpp 4 Jul 2007 16:34:16 -0000
@@ -147,7 +147,7 @@
virtual void * get_deleter( std::type_info const & ti )
{
- return ti == typeid(D)? &del: 0;
+ return ti == typeid(D)? &reinterpret_cast
participants (2)
-
Peter Dimov
-
Scott French