在地址
http://blog.csdn.net/butterfly_dreaming/article/details/10142443
中,关于trim函数的方法3:gcc编译器不能通过问题。
这是该代码:
/*
Filename : stringTrim1.cpp
Compiler : Visual C++ 8.0
Description : Demo how to trim string by other method.
Release : 11/18/2006
*/
#include <string>
#include <iostream>
#include <cwctype>
template <class T>
std::basic_string<T>& trim(std::basic_string<T>&);
int main( )
{
std::string s = " Hello World!! ";
std::cout << s << " size:" << s.size() << std::endl;
std::cout << trim(s) << " size:" << trim(s).size() << std::endl;
return 0;
}
template <class T&g