Boost logo

Boost Users :

Subject: Re: [Boost-users] matrix function template for triangular_matrix and matrix datatypes
From: Max S. Kaznady (max.kaznady_at_[hidden])
Date: 2010-08-02 18:52:21

Sorry for the spam, I didn't realize that C++ has a template problem.
One possible resolution is to place the source inside the header file,
which is what I did. There another resolution, which uses the "export"
keyword and you can also place the template declaration at the end of
the source file.


On Mon, Aug 2, 2010 at 2:05 PM, Max S. Kaznady <max.kaznady_at_[hidden]> wrote:
> Suppose we are working in namespace boost::numeric::ublas and I have 2 functions
> 1) template <class T> save_matrix(matrix<T> const &m)
> 2) template <class T> save_matrix(triangular_matrix<T,lower> const &m)
> and the code in both overloaded save_matrix functions is identical.
> How can I write a templated function which accepts any type of a
> matrix? I tried this, but it didn't work:
> template <class T> save_matrix(T const &m)
> Thanks,
> Max

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