RE: [boost] boost::lambda::operator* and smart pointers

I think this level of indirection is already encapsulated in boost::pointee. eyal. -----Original Message----- From: Maxim Yegorushkin [mailto:e-maxim@yandex.ru] Sent: Saturday, March 20, 2004 4:50 AM To: boost@lists.boost.org Subject: [boost] boost::lambda::operator* and smart pointers Hi guys. I encountered a pitfall when trying to use boost::lambda for dereferencing a smart pointer. Current lambda implementation assumes that operator*() can be applied to either a plain pointer or an iterator. That leads to an error message when applying the operator to a smart pointer complaining about std::iterator_traits<> not being specialized for the smart pointer. Consider the code: struct some { void foo(int); }; boost::shared_ptr<some> ptr(new some); ( lm::bind( &some::foo , *lm::_1 , 0 ) ) (ptr); the bind expression won’t compile until we hack std::iterator_traits<boost::shared_ptr<> >: template<class T> struct std::iterator_traits<boost::shared_ptr<T> > : std::iterator<void, T> { }; My point is: why don’t add an additional level of indirection for boost::lambda::detail::contentsof_type<> so that the indirection will allow the user to specialize it for smart pointers? -- Maxim Yegorushkin MetaCommunications Engineering http://www.meta-comm.com/engineering/ _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
participants (2)
-
Eyal Farago
-
Maxim Yegorushkin