Vaclav
I have taken the liberty to cross-post this
microsoft.public.dotnet.languages.vc which has more visibility from
MSFT VC++ team.
thanks
--Dilip
Actual post by Vaclav Haisman originally posted at
comp.lang.c++.moderated follows:
================================================== ========================
I have this test case that VC++.NET 2005 beta refuses to compile. I
think
that it is valid C++. If it is, is there a "bugzilla" for the compiler
where
I could report it?
VH
#include <string>
#include <iterator>
template <typename T>
struct default_index_policy
{
typedef T index_type;
template <typename U>
index_type
minus_left (index_type const & t, U const & u) const
{
return t - u;
}
};
/////////////////////////////////////////////////////////////////
typedef size_t _default_index_type;
template <typename Iterator, typename Index = _default_index_type,
typename IndexPolicy = default_index_policy<Index> >
class indexing_iterator
{
public:
typedef Iterator iterator_type;
typedef Index index_type;
typedef IndexPolicy index_policy_type;
class IndexProxy
{
protected:
index_type const idx;
index_policy_type const idx_policy;
public:
IndexProxy (index_type const & i, index_policy_type const &
pol)
: idx (i), idx_policy (pol)
{ }
index_type index () const
{
return idx;
}
operator index_type () const
{
return idx;
}
// IndexProxy operators:
template <typename U>
friend IndexProxy
operator - (IndexProxy const & p, U const & u)
{
return IndexProxy (p.idx_policy.minus_left (p.index (),
u),
p.idx_policy);
}
};
typedef IndexProxy index_proxy_type;
protected:
iterator_type current;
index_type idx;
index_policy_type idx_policy;
public:
indexing_iterator ()
{ }
index_proxy_type
index () const
{
return IndexProxy (idx, idx_policy);
}
};
///////////////////////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])
{
indexing_iterator<std::string::const_iterator, int,
default_index_policy<int> > it;
int index = it.index () - 1;
return 0;
}
Build log:
------ Build started: Project: test, Configuration: Debug Win32 ------
Compiling...
test.cpp
d:\WilX\VS.NET\test\test\test.cpp(57) : error C3861: 'IndexProxy':
identifier not found
d:\WilX\VS.NET\test\test\test.cpp(84) : see reference to
function
template instantiation
'indexing_iterator<Iterator,Index,IndexPolicy>::In dexProxy
operator -<int>(const
indexing_iterator<Iterator,Index,IndexPolicy>::Ind exProxy &,const U
&)'
being compiled
with
[
Iterator=std::_String_const_iterator<char,std::cha r_traits<char>,std::allocator<char>>,
Index=int,
IndexPolicy=default_index_policy<int>,
U=int
]
Build log was saved at
"file://d:\WilX\VS.NET\test\test\Debug\BuildLog.htm"
test - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========
================================================== ========================
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]