Boost logo

Boost Users :

Subject: [Boost-users] boost + stlport : Failed to specialize function template
From: gatotkaca (dio_chernobyl_at_[hidden])
Date: 2008-10-29 22:33:23


Hello!

I'm trying to compile following code (msvc8 + boost1.36.0 + stlport5.1.7)

#include <boost/range/size.hpp>

#include <iostream>
#include <vector>

template< class InputRng, class T >
inline T accumulate( const InputRng& r, T init )
{
        return std::accumulate( boost::begin(r), boost::end(r), init );
}

template <typename Range>
typename boost::range_iterator<Range>::type::value_type
mean(const Range &range, typename
boost::range_iterator<Range>::type::value_type init=
#ifndef BOOST_MSVC
        typename
#endif
         boost::range_iterator<Range>::type::value_type())
{
    return typename boost::range_iterator<Range>::type::value_type(
        boost::accumulate(range, init)/boost::size(range));
}

int main(){

        std::cout << "test" << std::endl;

        std::vector<double> data;

        data.push_back(1);
        data.push_back(2);
        data.push_back(3);

        double m = mean(data);

        std::cout << m << std::endl;

        return 0;
}

It keeps giving me:

error C2893: Failed to specialize function template
'boost::range_iterator<C>::type::value_type mean(const Range
&,boost::range_iterator<C>::type::value_type)' ..\my
works\misc\mean_range_test\testapp.cpp 35

BUT, if I remove the dependency to the STLport (and use MSVC's STL), it
works fine!

Unfortunately, I need this STLport to work on.

I really appreciate for any helps. Thank you!

Best,

Dio

 

-- 
View this message in context: http://www.nabble.com/boost-%2B-stlport-%3A-Failed-to-specialize-function-template-tp20239895p20239895.html
Sent from the Boost - Users mailing list archive at Nabble.com.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net