backprop_result(MyAnn::backPropgration<double,
std::vector>(MultiLayerNeuron, 1.9, 8, 10, 12)); // debugtest.cpp line
70.

template <typename T,
template <typename ELEM, typename = std::allocator<ELEM> >
class CONT
>
CONT<CONT<T> > backPropgration(
const typename multiLayerExample<T, CONT>::mapInOut& examples,
const T& rate,
const typename CONT<T>::size_type& nIn,
const typename CONT<T>::size_type& nOut,
const typename CONT<T>::size_type& nHidden
); // inside backproagation.hpp

template <typename T,
template <typename ELEM, typename = std::allocator<ELEM> >
class CONT
>
CONT<CONT<T> > backPropgration(
const typename multiLayerExample<T, CONT>::mapInOut& examples,
const T& rate,
const typename CONT<T>::size_type& nIn,
const typename CONT<T>::size_type& nOut,
const typename CONT<T>::size_type& nHidden
)
{
// definition of code.
}
// this is inside backproapation.cpp


Here is my error:
./cs461/c++/debugtest.cpp(70) : error C2668:
'MyAnn::backPropgration' : ambiguous call to overloaded function
c:\cpw\msvc\cs461\c++\cppdef/backproagation.cpp(141):
could be 'std::vector<_Ty>
MyAnn::backPropgration<double,std::vector>(const std::map<_Kty,_Ty>
&,const T &,const unsigned int &,const unsigned int &,const unsigned
int &)'
with
[
_Ty=std::vector<double>,
_Kty=std::vector<std::vector<double>>,
T=double
]
c:\cpw\msvc\cs461\c++\cppdef\../backpropagation.hpp(22): or
'std::vector<_Ty>
MyAnn::backPropgration<double,std::vector>(const std::map<_Kty,_Ty>
&,const T &,const unsigned int &,const unsigned int &,const unsigned
int &)'
with
[
_Ty=std::vector<double>,
_Kty=std::vector<std::vector<double>>,
T=double
]
while trying to match the argument list '(std::map<_Kty,_Ty>,
double, int, int, int)'
with
[
_Kty=std::vector<std::vector<double>>,
_Ty=std::vector<double>
]

Re: ambiguous overloaded function. by Alex

Alex
Fri Dec 07 00:32:41 PST 2007

<cablepuff@gmail.com> wrote:
> backprop_result(MyAnn::backPropgration<double,
> std::vector>(MultiLayerNeuron, 1.9, 8, 10, 12));

How do you declare `MultiLayerNeuron'? It seems that
`MultiLayerNeuron' is of type `multiLayerExample<T, CONT>'
rather than `multiLayerExample<T, CONT>::mapInOut'. I tried
it with following declaratoon and everything works
perfectly:

template <
typename T,
template <
typename ELEM,
typename = std::allocator<ELEM>
> class CONT
>
struct multiLayerExample
{
typedef std::map<CONT<CONT<T> >, CONT<T> > mapInOut;
};

// ...

multiLayerExample<
double, std::vector>::mapInOut MultiLayerNeuron;

backPropgration<double, std::vector>(
MultiLayerNeuron, 1.9, 8, 10, 12);


HTH
Alex


Re: ambiguous overloaded function. by cablepuff

cablepuff
Fri Dec 07 10:19:04 PST 2007

On Dec 7, 12:32 am, "Alex Blekhman" <tkfx.REM...@yahoo.com> wrote:
> <cablep...@gmail.com> wrote:
> > backprop_result(MyAnn::backPropgration<double,
> > std::vector>(MultiLayerNeuron, 1.9, 8, 10, 12));
>
> How do you declare `MultiLayerNeuron'? It seems that
> `MultiLayerNeuron' is of type `multiLayerExample<T, CONT>'
> rather than `multiLayerExample<T, CONT>::mapInOut'. I tried
> it with following declaratoon and everything works
> perfectly:
>
> template <
> typename T,
> template <
> typename ELEM,
> typename = std::allocator<ELEM>
> > class CONT
>
> struct multiLayerExample
> {
> typedef std::map<CONT<CONT<T> >, CONT<T> > mapInOut;
>
> };
>
> // ...
>
> multiLayerExample<
> double, std::vector>::mapInOut MultiLayerNeuron;
>
> backPropgration<double, std::vector>(
> MultiLayerNeuron, 1.9, 8, 10, 12);
>
> HTH
> Alex

MyAnn::multiLayerExample<double, std::vector>::mapInOut
MultiLayerNeuron;

Re: ambiguous overloaded function. by Alex

Alex
Fri Dec 07 11:11:47 PST 2007

<cablepuff@gmail.com> wrote:
>> How do you declare `MultiLayerNeuron'?
>
> MyAnn::multiLayerExample<double, std::vector>::mapInOut
> MultiLayerNeuron;

So show the declaration of `multiLayerExample' template and
provide concise example that can be compiled. Otherwise,
your code works perfectly for me.

Alex


Re: ambiguous overloaded function. by cablepuff

cablepuff
Sat Dec 08 09:30:56 PST 2007

On Dec 7, 11:11 am, "Alex Blekhman" <tkfx.REM...@yahoo.com> wrote:
> <cablep...@gmail.com> wrote:
> >> How do you declare `MultiLayerNeuron'?
>
> > MyAnn::multiLayerExample<double, std::vector>::mapInOut
> > MultiLayerNeuron;
>
> So show the declaration of `multiLayerExample' template and
> provide concise example that can be compiled. Otherwise,
> your code works perfectly for me.
>
> Alex

this is inside trainexample.hpp.
/*
* trait class for multilayer example
* members:
* mapInOut represent each indivdual examples
* key: CONT<T>, value: CONT<T>
*/
template <typename T,
template <typename ELEM, typename = std::allocator<ELEM> >
class CONT
>
class multiLayerExample
{
typedef CONT<T> vecT;
public:
typedef typename std::map<CONT<vecT>, vecT> mapInOut;
};

Both backprogation.hpp and backpropagation.cpp includes
trainexample.hpp with external include guards.

#ifndef TRAINEXAMPLE_HPP
#include "trainexample.hpp"
#endif

Re: ambiguous overloaded function. by Alex

Alex
Sun Dec 09 03:19:59 PST 2007

I tried the following code both with VC++2005 and VC++2008.
In all cases it compiles and links without any problem.

-----------------
#include <cstdio>
#include <tchar.h>

#include <vector>
#include <string>
#include <map>

namespace MyAnn
{
/*
* trait class for multilayer example
* members:
* mapInOut represent each indivdual examples
* key: CONT<T>, value: CONT<T>
*/
template <
typename T,
template <
typename ELEM, typename = std::allocator<ELEM>
> class CONT
>
class multiLayerExample
{
typedef CONT<T> vecT;
public:
typedef typename std::map<CONT<vecT>, vecT> mapInOut;
};

template <
typename T,
template <
typename ELEM, typename = std::allocator<ELEM>
> class CONT
>
CONT<CONT<T> > backPropgration(
const typename multiLayerExample<T, CONT>::mapInOut&
examples,
const T& rate,
const typename CONT<T>::size_type& nIn,
const typename CONT<T>::size_type& nOut,
const typename CONT<T>::size_type& nHidden
)
{
CONT<CONT<T> > c;
return c;
}

} // MyAnn


int _tmain(int argc, _TCHAR* argv[])
{
MyAnn::multiLayerExample<double, std::vector>::mapInOut
MultiLayerNeuron;

MyAnn::backPropgration<double, std::vector>(
MultiLayerNeuron, 1.9, 8, 10, 12);

return 0;
}

-----------------
Alex