Re: templated func : what's wrong
joe wrote:
:: On Aug 8, 3:48 am, mosfet <john....@anonymous.org> wrote:
::: HI,
:::
::: when trying to compile an embedded version of STL called ustl on
::: win32 platform I get the following error :
:::
::: /// Returns the minimum of \p a and \p b
::: template <typename T1, typename T2>
::: inline const T1 min (const T1& a, const T2& b)
::: {
::: return (a < b ? a : b);
:::
::: }
:::
::: 1>c:\program files\microsoft visual studio
::: 8\vc\include\ustl\uutility.h(69) : error C2027: use of undefined
::: type 'T1' 1>c:\program files\microsoft visual studio
::: 8\vc\include\ustl\uutility.h(69) : error C2226: syntax error :
::: unexpected type 'T1'
::: 1>c:\program files\microsoft visual studio
::: 8\vc\include\ustl\uutility.h(69) : error C2988: unrecognizable
::: template declaration/definition
::: 1>c:\program files\microsoft visual studio
::: 8\vc\include\ustl\uutility.h(69) : error C2059: syntax error :
::: '<cv-qualifer>'
::: 1>c:\program files\microsoft visual studio
::: 8\vc\include\ustl\uutility.h(69) : error C2059: syntax error : ')'
:::
::: I think it comes from the fact template functions like this are
::: not standard C++.
::: Could someone confirm ?
:::
::: How can I change that ?
::
:: Btw, it compiles for me as is on VC 8.0
::
:: joe
It depends on the settings, and what headers you include.
On VC way to get rid of these macros is the define the macro NOMINMAX
in you project settings.
Bo Persson