@rojkov std::string may contain '\0', so should we pass str.size() to serialize?
|
inline |
|
FastCdr& serialize( |
|
const std::string& string_t) |
|
{ |
|
return serialize(string_t.c_str()); |
|
} |
Below is the test code
#include <iostream>
#include <string>
#include <cstring>
int main()
{
const char* c_str = "Hello\0World";
std::string str(c_str, 11);
std::cout << str.size() << std::endl; // 11
std::cout << strlen(str.c_str()) << std::endl; // 5
return 0;
}
@rojkov
std::stringmay contain '\0', so should we pass str.size() toserialize?Fast-CDR/include/fastcdr/FastCdr.h
Lines 887 to 892 in 24d9e72
Below is the test code