[RFC] libstdc++/8780
Paolo Carlini
pcarlini@unitus.it
Mon Dec 2 05:02:00 GMT 2002
Hi Gaby, hi everyone,
I'm looking a bit into this PR. This is the testcase:
//////////
#include <vector>
template<int> struct static_assert_test{};
template <bool> struct STATIC_ASSERTION_FAILURE;
template <> struct STATIC_ASSERTION_FAILURE<true>{};
#define BOOST_STATIC_ASSERT( B ) static_assert_test<sizeof(STATIC_ASSERTION_FAILURE< ( B ) >)>
template <typename T> struct is_pointer_helper
{ static const bool value = false; };
template <typename T> struct is_pointer_helper<T*>
{ static const bool value = true; };
template <typename T> struct is_pointer_helper<T*const>
{ static const bool value = true; };
template <typename T> struct is_pointer_helper<T*volatile>
{ static const bool value = true; };
template <typename T> struct is_pointer_helper<T*const volatile>
{ static const bool value = true; };
int main(void)
{
BOOST_STATIC_ASSERT(is_pointer_helper<std::vector<int>::iterator>::value);
return(0);
}
//////////
The compilation fails with any v3. This seems due to the fact that,
whereas in v2, for std::vector, simply:
typedef value_type* iterator;
in v3:
typedef __gnu_cxx::__normal_iterator<pointer, vector_type> iterator;
Submitter cites 24.1,(1,2) as implying that the current implementation is
non conforming. This seems to me non at all obvious! It is just a QoI issue?
(in few other widespread implementations iterator *is* just a pointer)
Much more generally, I'm interested in knowing why the implementation
of iterator was changed in such a way in the transition between v2 and v3.
Thanks for the attention,
Paolo.
More information about the Libstdc++
mailing list