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


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
    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;


        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!




View this message in context:
Sent from the Boost - Users mailing list archive at

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at