|
Boost : |
From: Eyal Farago (eyal.farago_at_[hidden])
Date: 2004-03-21 04:06:30
I think this level of indirection is already encapsulated in boost::pointee.
eyal.
-----Original Message-----
From: Maxim Yegorushkin [mailto:e-maxim_at_[hidden]]
Sent: Saturday, March 20, 2004 4:50 AM
To: boost_at_[hidden]
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk