M

#### ma740988

#ifndef TRIAL_H

#define TRIAL_H

# include <vector>

# include <complex>

# include <iostream>

template <typename scalar>

struct complex_param

{

typedef typename std::complex<scalar> complex_type;

typedef typename std::vector< complex_type > cvec_type;

typedef typename cvec_type::size_type cvec_size_type;

typedef typename cvec_type::const_iterator cvec_const_iter;

typedef typename cvec_type::iterator cvec_iter;

};

typedef complex_param<double>::complex_type complex_d;

typedef complex_param<float>::complex_type complex_f;

typedef complex_param<double>::cvec_type cvec_type_d;

typedef complex_param<float>::cvec_type cvec_type_f;

template < typename T >

void run_it ( typename complex_param<T>::cvec_type& cvec )

{

complex_param<T>::cvec_size_type const sz = cvec.size();

for ( complex_param<T>::cvec_size_type idx ( 0 ); idx < sz; ++idx )

std::cout << cvec [ idx ] << std::endl;

}

#endif

//main.cpp

int main()

{

cvec_type_d d;

d.push_back ( complex_d ( 1.0, 2. ) );

run_it <double> ( d );

// run_it ( d ); //2

}

For the item marked "//2". .NET 2005 complains

" Could not deduce template argument for T "

Why no argument deduction for T when I used cvec_type_d and complex_d ?