id summary reporter owner description type status milestone component version severity resolution keywords cc 6874 Path should have a size() member function Gary Sanders Beman Dawes "It would be convenient for filesystem::path to provide a size() member function, especially for circumstances that require interface with legacy windows apps and functions. Consider the traditional windows path buffer: {{{ wchar_t legacy [_MAX_PATH]; }}} and a boost path: {{{ boost::filesystem::path path = L""<...>""; }}} In order to ensure that buffer overruns do not occur when copying into a legacy buffer, assuming that querying the size of the wstring() member function is the same as the c_str() size, code similar to the following is required: {{{ if (path.wstring().size()+1 <= _MAX_PATH) { wcscpy(&legacy[0], path.c_str()); } else { // buffer would overrun, do something else ... } }}} It would be more convenient, and arguably safer, if filesystem::path provides the size of the string that is referenced by the c_str() function. {{{ if (path.size()+1 <= _MAX_PATH) { wcscpy(&legacy[0], path.c_str()); } else { // buffer would overrun, do something else ... } }}} " Feature Requests closed To Be Determined filesystem Boost 1.49.0 Problem fixed path size