Calling std::towlower and returning the converted string
std::wstring temp = std::transform( field->GetFieldType().begin(), field->GetFieldType().end(), field->GetFieldType().begin(), [](wchar_t c) { return std::towlower( c ); } );
if( temp == L"date" || temp == L"text" )
Doing this in MSVC produces:
1\> c:\\users\\igor\\onedrive\\documents\\dbhandler_app\\libsqlite\\database_sqlite.cpp(1227): error C2440: 'initializing': cannot convert from '\_OutIt' to 'std::basic_string\,std::allocator\\>'
1\> with
1\> \[
1\> \_OutIt=std::\_String_const_iterator\\>\>
1\> \]
1\> c:\\users\\igor\\onedrive\\documents\\dbhandler_app\\libsqlite\\database_sqlite.cpp(1227): note: No constructor could take the source type, or constructor overload resolution was ambiguous
Using auto instead of std::wstring gives different problem:
1\> c:\\users\\igor\\onedrive\\documents\\dbhandler_app\\libsqlite\\database_sqlite.cpp(1228): error C2678: binary '==': no operator found which takes a left-hand operand of type '\_OutIt' (or there is no acceptable conversion)
1\> with
1\> \[
1\> \_OutIt=std::\_String_const_iterator\\>\>
1\> \]
1\> c:\\program files (x86)\\microsoft visual studio\\2017\\community\\vc\\tools\\msvc\\14.16.27023\\include\\xstring(1555): note: could be 'bool std::\_String_const_iterator\\>\>::operator ==(const std::\_String_const_iterator\\>\> &) const'
1\> with
1\> \[
1\> \_Ty=wchar_t
1\> \]
1\> c:\\program files (x86)\\windows kits\\10\\include\\10.0.10240.0\\shared\\guiddef.h(192): note: or 'bool operator ==(const GUID &,const GUID &)'
1\> c:\\program files (x86)\\microsoft visual studio\\2017\\community\\vc\\tools\\msvc\\14.16.27023\\include\\exception(321): note: or 'bool std::operator ==(const std::exception_ptr &,const std::exception_ptr &) noexcept' \[found using argument-dependent lookup\]
1\> c:\\program files (x86)\\microsoft visual studio\\2017\\community\\vc\\tools\\msvc\\14.16.27023\\include\\exception(326): note: or 'bool std::operator ==(std::nullptr_t,const std::exception_ptr &) noexcept' \[found using argument-dependent lookup\]
1\> c:\\program files (x86)\\microsoft visual studio\\2017\\community\\vc\\tools\\msvc\\14.16.27023\\include\\exception(331): note: or 'bool std::operator ==(const std::exception_ptr &,std::nullptr_t) noexcept' \[found using argument-dependent lookup\]
1\> c:\\program files (x86)\\microsoft visual studio\\2017\\community\\vc\\tools\\msvc\\14.16.27023\\include\\system_error(266): note: or 'bool std::operator ==(const std::error_code &,const std::error_code &) noexcept' \[found using argument-dependent lookup\]
1\> c:\\program files (x86)\\microsoft visual studio\\2017\\community\\vc\\tools\\msvc\\14.16.27023\\include\\system_error(272): note: or 'bool std::operator ==(const std::error_code &,const std::error_condition &) noexcept' \[found using argument-dependent lookup\]
1\> c:\\program files (x86)\\microsoft visual studio\\2017\\community\\vc\\tools\\msvc\\14.16.27023\\include\\system_error(278): note: or 'bool std::operator ==(const std::error_condition &,const std::error_code &) noexcept' \[found using argument-dependent lookup\]
1\> c:\\program files (x86)\\microsoft visual studio\\2017\\community\\vc\\tools\\msvc\\14.16.27023\\include\\system_error(284): note: or 'bool std::operator ==(const std::error_condition &,const std::error_condition &) noexcept' \[found using argument-dependent lookup\]
1\> c:\\program files (x86)\\microsoft visual studio\\2017\\community\\vc\\tools\\msvc\\14.16.27023\\include\\thread(208): note: or 'bool std::operator ==(std::thread::id,std::thread::id) noexcept' \[found using argument-dependent lookup\]
1\> c:\\users\\igor\\onedrive\\documents\\dbhandler_app\\libsqlite\\database_sqlite.cpp(1228): note: or 'built-in C++ operator==(const wchar_t \[5\], const wchar_t \[5\])'
1\> c:\\users\\igor\\onedrive\\documents\\dbhandler_app\\libsqlite\\database_sqlite.cpp(1228): note: while trying to match the argument list '(\_OutIt, const wchar_t \[5\])'
1\> with
1\> \[
1\> \_OutIt=std::\_String_const_iterator\\>\>
1\> \]
How to convert and return?
Don't care about locales - just need a type conversion.