|
Boost : |
From: jbandela_at_[hidden]
Date: 2001-12-03 00:09:02
In making a recent change to tokenizer, I ended up needing the
category of the iterator. It proved to be a real pain, because
1) iterator_traits only works nice on compilers with partial template
specialization
2) Every library defines (it seems) a different function to get the
iterator category.
It seems it would be useful to have a BOOST_ITERATOR_CATEGORY in
config.hpp
Here is a version called BOOST_DETAIL_ITERATOR_CATEGORY that I made
using the iterator_category functions in
\boost\libs\regex\test\regress\regress.h as a guide
Let me know what you think
Regards,
John R. Bandela
#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // No partial
specialization
#ifdef __SGI_STL_PORT // STLPort
#if __SGI_STL_PORT <= 0x400
#define BOOST_DETAIL_ITERATOR_CATEGORY(iter,tp)
std::__ITERATOR_CATEGORY(iter)
#else
#define BOOST_DETAIL_ITERATOR_CATEGORY(iter,tp)
std::_STLP_ITERATOR_CATEGORY(iter,tp)
#endif
#elif BOOST_RWSTD_VER
#define BOOST_DETAIL_ITERATOR_CATEGORY(iter,tp)
std::__iterator_category(iter)
#elif defined(__STL_CONFIG_H)
#define BOOST_DETAIL_ITERATOR_CATEGORY(iter,tp)
std::iterator_category(iter)
#elif (defined(BOOST_MSVC) || defined(__ICL)) && (defined(_YVALS) ||
defined(_CPPLIB_VER))
#define BOOST_DETAIL_ITERATOR_CATEGORY(iter,tp) std::_Iter_cat
(iter)
#else
#define BOOST_DETAIL_ITERATOR_CATEGORY(iter,tp) \
std::iterator_traits<tp>::iterator_category()
#endif
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
#define BOOST_DETAIL_ITERATOR_CATEGORY(iter,tp) \
std::iterator_traits<tp>::iterator_category()
#endif
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk