|
Boost : |
From: Jody Hagins (jody-boost-011304_at_[hidden])
Date: 2005-03-10 13:07:53
On Thu, 10 Mar 2005 17:44:34 +0000
Russell Hind <rh_gmane_at_[hidden]> wrote:
> template<typename Range>
> std::vector<int> to_vector_foreach_byval( Range & rng )
> {
> std::vector<int> vect;
> typedef typename ::boost::range_result_iterator<Range>::type
> iterator; typedef typename
> ::boost::iterator_value<iterator>::type value; BOOST_FOREACH(
> value i, rng ) {
> vect.push_back(i);
> }
> return vect;
> }
>
> The two typedef lines give these errors:
>
> [C++ Error] main.cpp(110): E2437 'typename' should be followed by a
> qualified, dependent type name
> [C++ Error] main.cpp(111): E2437 'typename' should be followed by a
> qualified, dependent type name
>
> So quite a few of these through the regression .cpp file. Any ideas
> how to solve these so I can run the tests?
replace typename with BOOST_DEDUCED_TYPENAME and see if that works. If
not, then you may need a similar workaround that is used elsewhere...
template<typename Range>
std::vector<int> to_vector_foreach_byval( Range & rng )
{
#if defined(__BORLANDC__) && (__BORLANDC__ <= 0x564)
# define BOOST_typename
#else
# define BOOST_typename BOOST_DEDUCED_TYPENAME
#endif
std::vector<int> vect;
typedef BOOST_typename ::boost::range_result_iterator<Range>::type
iterator;
typedef BOOST_typename ::boost::iterator_value<iterator>::type
value;
BOOST_FOREACH( value i, rng )
{
vect.push_back(i);
}
return vect;
#undef BOOST_typename
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk