From 08a2ab3fe66d8baee3204a557c4ef0e7b7dcefa3 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Sat, 10 Feb 2001 00:05:17 +0000 Subject: [PATCH] Always have a definition for each traits member, even if it can't be properly deduced. These will be incomplete types in some cases (undefined), but it helps suppress MSVC errors elsewhere [SVN r9064] --- include/boost/detail/iterator.hpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/include/boost/detail/iterator.hpp b/include/boost/detail/iterator.hpp index 4376006..eb8f692 100644 --- a/include/boost/detail/iterator.hpp +++ b/include/boost/detail/iterator.hpp @@ -23,6 +23,10 @@ // See http://www.boost.org for most recent version including documentation. // Revision History +// 09 Feb 2001 - Always have a definition for each traits member, even if it +// can't be properly deduced. These will be incomplete types in +// some cases (undefined), but it helps suppress MSVC errors +// elsewhere (David Abrahams) // 07 Feb 2001 - Support for more of the traits members where possible, making // this useful as a replacement for std::iterator_traits when // used as a default template parameter. @@ -63,6 +67,7 @@ using std::distance; // Workarounds for less-capable implementations template struct iterator_traits_select; +template struct undefined; template <> struct iterator_traits_select { template @@ -70,6 +75,14 @@ template <> struct iterator_traits_select { typedef std::ptrdiff_t difference_type; typedef std::random_access_iterator_tag iterator_category; +#ifdef BOOST_MSVC +// Keeps MSVC happy under certain circumstances. It seems class template default +// arguments are partly instantiated even when not used when the class template +// is the return type of a function template. + typedef undefined value_type; + typedef undefined pointer; + typedef undefined reference; +#endif }; }; @@ -132,8 +145,6 @@ struct bad_output_iterator_select }; # endif -template struct undefined; - template <> struct iterator_traits_select { template @@ -143,6 +154,10 @@ template <> struct iterator_traits_select # if defined(BOOST_MSVC) && !defined(__SGI_STL_PORT) typedef typename Iterator::distance_type difference_type; typedef typename Iterator::value_type value_type; +#ifdef BOOST_MSVC // Keeps MSVC happy under certain circumstances + typedef undefined pointer; + typedef undefined reference; +#endif # elif !defined(BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION) typedef typename Iterator::difference_type difference_type; typedef typename Iterator::value_type value_type;