From 22b7e0fc2554b3330a324f24cf29ce939e04e3d6 Mon Sep 17 00:00:00 2001 From: Frank Seide Date: Fri, 31 Oct 2014 12:33:46 -0700 Subject: [PATCH] fixed some "default assignment operator deleted" issues with GCC; two more mapped CRT functions that don't exist in GCC --- Common/Include/basetypes.h | 2 ++ Common/Include/commandArgUtil.h | 27 +++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Common/Include/basetypes.h b/Common/Include/basetypes.h index 2cf2b20b7..5e5179581 100644 --- a/Common/Include/basetypes.h +++ b/Common/Include/basetypes.h @@ -150,6 +150,8 @@ static inline wchar_t* wcstok_s (wchar_t* s, const wchar_t* delim, wchar_t** ptr static inline int _stricmp (const char * a, const char * b) { return ::strcasecmp (a, b); } static inline int _strnicmp (const char * a, const char * b, wchar_t n) { return ::strncasecmp (a, b, n); } static inline int _wcsicmp (const wchar_t * a, const wchar_t * b) { return ::wcscasecmp (a, b); } +static inline int64_t _strtoi64 (const char * s, char ** ep, int r) { return strtoll (s, ep, r); } // TODO: check if correct +static inline uint64_t _strtoui64 (const char * s, char ** ep, int r) { return strtoull (s, ep, r); } // TODO: correct for size_t? // -- other static inline void Sleep (size_t ms) { std::this_thread::sleep_for (std::chrono::milliseconds (ms)); } #endif diff --git a/Common/Include/commandArgUtil.h b/Common/Include/commandArgUtil.h index d175edf60..c70772049 100644 --- a/Common/Include/commandArgUtil.h +++ b/Common/Include/commandArgUtil.h @@ -244,6 +244,16 @@ namespace Microsoft { namespace MSR { namespace CNTK { m_separator = configParser.m_separator; m_configName = move(configParser.m_configName); } + ConfigParser& operator=(const ConfigParser& configParser) + { + m_separator = configParser.m_separator; + m_configName = configParser.m_configName; + } + ConfigParser& operator=(const ConfigParser&& configParser) + { + m_separator = configParser.m_separator; + m_configName = move(configParser.m_configName); + } public: // FindBraces - find matching braces in a string starting at the current position @@ -873,7 +883,7 @@ namespace Microsoft { namespace MSR { namespace CNTK { m_repeatAsterisk = repeatAsterisk; } - // copy and move constructors + // copy and move constructors and assignment ConfigArray(const ConfigArray& configValue) : ConfigParser(configValue) { m_repeatAsterisk = true; @@ -884,6 +894,18 @@ namespace Microsoft { namespace MSR { namespace CNTK { m_repeatAsterisk = true; *this = move(configValue); } + ConfigArray& operator=(const ConfigArray& configValue) + { + ConfigParser::operator=(configValue); + m_repeatAsterisk = true; + *this = configValue; + } + ConfigArray& operator=(const ConfigArray&& configValue) + { + ConfigParser::operator=(move(configValue)); + m_repeatAsterisk = true; + *this = move(configValue); + } // cast a configArray back to a string so we can return it as a ConfigValue operator ConfigValue() @@ -951,7 +973,7 @@ namespace Microsoft { namespace MSR { namespace CNTK { for (int i=0;i < count;++i) { char buf[10]; - _itoa_s((int)size(), buf, 10); + sprintf (buf, "%d", (int)size()); // TODO: left-over of Linux compat, can be done nicer std::string name = m_configName + '[' + buf + ']' ; push_back(ConfigValue(value, name)); } @@ -980,6 +1002,7 @@ namespace Microsoft { namespace MSR { namespace CNTK { template class argvector : public std::vector { + typedef std::vector B; using B::clear; using B::reserve; static void parse (const std::wstring & in, float & val) { val = (float) msra::strfun::todouble (in); } static void parse (const std::wstring & in, size_t & val) // convert wstring toks2[0] to T val and check type {