Re: Explicitly specializing std::min() on VC++ 2005 Express Edition
- From: "Victor Bazarov" <v.Abazarov@xxxxxxxxxxxx>
- Date: Wed, 2 May 2007 15:42:47 -0400
Matthias Hofmann wrote:
"Victor Bazarov" <v.Abazarov@xxxxxxxxxxxx> schrieb im Newsbeitrag
news:f1al1r$m1m$1@xxxxxxxxxxxxxxxxxx
Did you include the header where the 'std::min' template is actually
defined? Unless the compiler knows that 'std::min' is a template, it
cannot allow you to specialise it.
Yes, I did. Here's the complete code I am using:
#include <algorithm> // Defines std::min().
#include <cstring> // Defines std::strcmp().
namespace std
{
template <> inline const char*& min<>
( const char*& a, const char*& b )
{
return std::strcmp( a, b ) < 0 ? a : b;
}
}
int main()
{
return 0;
}
I also tried different signatures, like 'const char* min( const char*
a, const char* b )', but those gave me the same error code.
Add 'const' to the type of the object referred to by arguments:
template<> inline const char* const& min<>
( const char* const& a, const char* const& b) ...
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
.
- Follow-Ups:
- Re: Explicitly specializing std::min() on VC++ 2005 Express Edition
- From: Matthias Hofmann
- Re: Explicitly specializing std::min() on VC++ 2005 Express Edition
- References:
- Explicitly specializing std::min() on VC++ 2005 Express Edition
- From: Matthias Hofmann
- Re: Explicitly specializing std::min() on VC++ 2005 Express Edition
- From: Victor Bazarov
- Re: Explicitly specializing std::min() on VC++ 2005 Express Edition
- From: Matthias Hofmann
- Explicitly specializing std::min() on VC++ 2005 Express Edition
- Prev by Date: Re: Converting Strings to Numbers
- Next by Date: Re: Explicitly specializing std::min() on VC++ 2005 Express Edition
- Previous by thread: Re: Explicitly specializing std::min() on VC++ 2005 Express Edition
- Next by thread: Re: Explicitly specializing std::min() on VC++ 2005 Express Edition
- Index(es):
Relevant Pages
|