Vaclav
I have taken the liberty to cross-post this
microsoft.publi c.dotnet.langua ges.vc which has more visibility from
MSFT VC++ team.
thanks
--Dilip
Actual post by Vaclav Haisman originally posted at
comp.lang.c++.m oderated 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_p olicy
{
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_p olicy<Index> >
class indexing_iterat or
{
public:
typedef Iterator iterator_type;
typedef Index index_type;
typedef IndexPolicy index_policy_ty pe;
class IndexProxy
{
protected:
index_type const idx;
index_policy_ty pe const idx_policy;
public:
IndexProxy (index_type const & i, index_policy_ty pe 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.m inus_left (p.index (),
u),
p.idx_policy);
}
};
typedef IndexProxy index_proxy_typ e;
protected:
iterator_type current;
index_type idx;
index_policy_ty pe idx_policy;
public:
indexing_iterat or ()
{ }
index_proxy_typ e
index () const
{
return IndexProxy (idx, idx_policy);
}
};
///////////////////////////////////////////////////////////////////////////////////
int main(int argc, char* argv[])
{
indexing_iterat or<std::string: :const_iterator , int,
default_index_p olicy<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_itera tor<Iterator,In dex,IndexPolicy >::IndexProxy
operator -<int>(const
indexing_iterat or<Iterator,Ind ex,IndexPolicy> ::IndexProxy &,const U
&)'
being compiled
with
[
Iterator=std::_ String_const_it erator<char,std ::char_traits<c har>,std::alloc ator<char>>,
Index=int,
IndexPolicy=def ault_index_poli cy<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++.m oderated. First time posters: Do this! ]