CStdString str; int length = 100; str.reserve(length);
CStdString str1, str2, str3; int length = 50; str1.reserve(length); str2.reserve(length); str3.reserve(length);In this example, we create three CStdString objects and reserve space for each with a length of 50. This ensures that if we add up to 50 characters to any of these strings, no reallocations will need to occur. Package/Library: This function is part of the MFC (Microsoft Foundation Classes) library, which is a framework for building Windows-based applications using C++.