C++C++11C++14C++17Learn C++

How To Use std::u16string In A Modern C++ App

What is u16string in modern C++? How can I use u16string in a C++ app? Is std::u16string same as std::string? Why I have an error when I define a std::u16string? Which literal should I use with the std::u16string? What is u16string? The u16string (std::u16string or std::pmr::u16string) are the string class data types for the 16bit characters defined in the std and std::pmr namespaces. It…
Read more
C++C++11C++14C++17Introduction to C++Learn C++

Using Iterators of String in C++ Software

How can I use Iterator methods of strings in my C++ software apps? What kind of iterator methods I can use with a std::string? How can I use begin(), end() iterator methods with strings? the at() method of strings? Can I use front() and back() methods in std::string to access characters? Modern C++ usesStrings, Wide Strings, andUnicode Stringsto support worldwide…
Read more
C++C++11C++14C++17Introduction to C++Learn C++

How To Convert A String to a Wide String In A Modern C++ App

How can I convert std::string to a std::wstring in a modern C++ app? How can I convert single byte string to 2-bytes wide string? Here are the answers with C++ examples. In Modern C++, there are several typedefs for common character types are provided: Wide string types are defined in header <string>. strings are the string class for byte characters represented with string. Alphanumeric…
Read more
C++C++11C++14C++17Introduction to C++

How To Force A Class Destructor In C++ Software

When you construct an object in C++ software, sometimes you need operations to deconstruct. Destructors not only used in classes but also used with struct and union data types. Do you want to learn what is Defaulted Destructor or what is Forcing a Destructor or what kind of methods we have that we can declare and use a virtual destructor? In this post, we will try to explain how to force a…
Read more