$include_dir="/home/hyper-archives/ublas/include"; include("$include_dir/msg-header.inc") ?>
From: Jan Amtrup (Jan_Amtrup_at_[hidden])
Date: 2005-09-20 18:49:27
Hello,
I am trying to use a mapped vector with the map array storage variant, and
I'm running 
Into trouble with Microsoft Visual Studio 7.1. Consider:
  #include <boost/numeric/ublas/vector_sparse.hpp>
  void main( int argc, char **argv) {
    using namespace boost::numeric::ublas;
    mapped_vector<float, map_array<std::size_t, float> > y( 10);
    return 0;
  }
Using Microsoft Visual Studio 7.1, this results in an error:
c:\Work\DeployRoot\include\boost\numeric\ublas\vector_sparse.hpp(300) :
error C2668: 'boost::numeric::ublas::detail::map_reserve' : ambiguous call
to overloaded function
The culprit are two versions of map_reserve, one more specialized than the
other. In 
Version 6.0 of the Microsoft compiler, template specialization was a
thorny issue, it 
seems, but I haven't found anything about 7.1 in this regard.
I tried to come up with some other examples, and it gets stranger. If you
have a 
function with one argument, specialization seems to work:
  template<class Container> 
  void xx( Container& cont) 
  {}
  template<class Scalar>
  void xx( std::vector<Scalar>& cont) 
  {}
  void main( int argc, char **argv) {
    std::vector<int> vi;
    xx( vi);
  }
Compiles fine.
If you have a function with two arguments, it fails:
  template<class Container> 
  void xx2( Container& cont, typename Container::value_type sc) 
  {}
  template<class Scalar>
  void xx2( std::vector<Scalar>& cont, Scalar sc) 
  {}
  void main( int argc, char **argv) {
    std::vector<int> vi;
    xx2( vi, (int) 5);
  }
Results in an error complaining about an ambiguous overload to the call of
xx2.
Am I doing something wrong, or does anybody have a workaround for this? 
Currently, we resort to only using mapped_vectors 
with the standard map as container, but eventually we want to use
map_arrays...
Thanks,
Jan.