dereference an iterator

Sorry for beeing off-topic, but is there a utility in boost for dereferencing an iterator, such as the below (but that also works for boost::reference_wrapper) template<class Iterator> typename std::iterator_traits<Iterator>::reference deref(Iterator i) { return *i; } Thanks, Christian

Christian Holmquist wrote:
Sorry for beeing off-topic, but is there a utility in boost for dereferencing an iterator, such as the below (but that also works for boost::reference_wrapper)
template<class Iterator> typename std::iterator_traits<Iterator>::reference deref(Iterator i) { return *i; }
Thanks, Christian
Apart from it looking a little tidier and so perhaps more readable, why would you need this when it works in exactly the same way as unary operator* (and so means more typing)? It might be useful if it had some checks for zero or bad pointers before it did the dereferencing, of course, but can that happen with Boost iterators (I'm not familiar enough with them to know)?

I want to be able to express the operator *() as a function (or function
object), like in the following trivial example.
template<class Iterator>
typename std::iterator_traits<Iterator>::reference deref(Iterator i)
{
return *i;
}
std::vector
Christian Holmquist wrote:
Sorry for beeing off-topic, but is there a utility in boost for dereferencing an iterator, such as the below (but that also works for boost::reference_wrapper)
template<class Iterator> typename std::iterator_traits<Iterator>::reference deref(Iterator i) { return *i; }
Thanks, Christian
Apart from it looking a little tidier and so perhaps more readable, why would you need this when it works in exactly the same way as unary operator* (and so means more typing)? It might be useful if it had some checks for zero or bad pointers before it did the dereferencing, of course, but can that happen with Boost iterators (I'm not familiar enough with them to know)?
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users

Hello all, I try to build boost with bz2 and zlib support under Windows XP and I have a strange behavior : only the FileClone operations are performed ! No lib built ! The following is my command : "C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat"; bjam --prefix=C:\ -sTOOLS=vc-8_0 -sBOOST_ROOT=C:\src\boost\boost_1_33_1 -sBUILD="debug release" --with-zlib=C:\lib\zlib.lib --with-lib bz2=C:\lib\libbz2.lib --sBZIP2_BINARY=libbz2 --sBZIP2_INCLUDE=C:\include -sBZIP2_LIBPATH=C:\bin -sBZIP2_SOURCE=C:\src\bzip2-1.0.4 -sZLIB_BINARY=zlib -sZLIB_INCLUDE=C:\include -sZLIB_LIBPATH=C:\lib -sZLIB_SOURCE=C:\src\zlib-1.2.3 --without-python install; Am I missing something ? It's important to note that that works well if I type "bjam" only (but I haven't the bz2 / zlib support). Thanks in advance. cd -- Cyril Delmas - Développeur d'applications Compagnie Générale d'Imagerie Numérique 55, route Jean Briaud 33693 Mérignac Cedex France Tél : +33 5 57 89 03 00 (standard) Tél : +33 5 57 89 03 05 (direct)
participants (4)
-
Christian Holmquist
-
Cyril
-
me22
-
Paul Giaccone