Most of us when port something with recent gcc, offten meet with issues when one or another function bring errors like "error: ‘func()’ is not a member of ‘std’".
Lately found that not only stoi(), but also stod(), stof(), stoul() and stol() can't be used as "not a members of std".
Doing some search, i found few files like this:
include\c++\8.2.0\bits\basic_string.h
include\c++\8.2.0\ext\vstring.h
Where we can see something like this (copy from vstring.h):
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
#if _GLIBCXX_USE_C99_STDLIB
// 21.4 Numeric Conversions [string.conversions].
inline int
stoi(const __vstring& __str, std::size_t* __idx = 0, int __base = 10)
{ return __gnu_cxx::__stoa<long, int>(&std::strtol, "stoi", __str.c_str(),
__idx, __base); }
inline long
stol(const __vstring& __str, std::size_t* __idx = 0, int __base = 10)
{ return __gnu_cxx::__stoa(&std::strtol, "stol", __str.c_str(),
__idx, __base); }
inline unsigned long
stoul(const __vstring& __str, std::size_t* __idx = 0, int __base = 10)
{ return __gnu_cxx::__stoa(&std::strtoul, "stoul", __str.c_str(),
__idx, __base); }
inline long long
stoll(const __vstring& __str, std::size_t* __idx = 0, int __base = 10)
{ return __gnu_cxx::__stoa(&std::strtoll, "stoll", __str.c_str(),
__idx, __base); }
inline unsigned long long
stoull(const __vstring& __str, std::size_t* __idx, int __base = 10)
{ return __gnu_cxx::__stoa(&std::strtoull, "stoull", __str.c_str(),
__idx, __base); }
// NB: strtof vs strtod.
inline float
stof(const __vstring& __str, std::size_t* __idx = 0)
{ return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx); }
inline double
stod(const __vstring& __str, std::size_t* __idx = 0)
{ return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx); }
inline long double
stold(const __vstring& __str, std::size_t* __idx = 0)
{ return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); }
#endif // _GLIBCXX_USE_C99_STDLIB
So, by logic enabling of _GLIBCXX_USE_C99_STDLIB should did the trick and they should work, but sadly just adding
#define _GLIBCXX_USE_C99_STDLIB 1
to include/c++/8.2.0/bits/c++config.h do not help.
It all just looks like it all can and should works, just in our GCC something not enabled or so..
Or maybe someone have some easy typedef which can be used instead ? Like something of that sort:
#ifdef __amigaos4__
namespace std
{
typedef stoi ....;
typedef stod ....;
typedef stof ....;
typedef stol ....;
typedef stoul ....;
}
#endif
Any ideas and help apprecated, thanks!