Я имею в виду следующий ответ: https://stackoverflow.com/a/79433983/6319901
OS Development OS: Ubuntu 24.04 LTS. Br />
My Target OS: VXWorks 7
язык: c ++ 17
< /p>
код: < /p>
Код: Выделить всё
#include
#include
#include
#include
#include
#include
#include
static const std::size_t MAX_PACKET_LENGTH = 512;
struct receive_t
{
int data1;
float data2;
std::string data;
receive_t()
{
data.reserve(MAX_PACKET_LENGTH);
}
};
int main(int argc, char const *argv[])
{
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79437512/how-to-validate-stdqueue-pre-allocate-memory-size[/url]