login about faq

Hello.

I am using C++11 standart. Application based to std::vector<unsigned char=""> (unsigned char == BYTE in Windows).

Question: How fast convert std::vector<unsigned char=""> to CkByteData?


My convertion code (slow speed):

std::vector<unsigned char> inputBuffer = { 0x01, 0x02, 0x03 };
CkByteData buffer;
for (int i = 0; i < (int)inputBuffer.size(); i++)
    buffer.appendChar(inputBuffer[i]);

asked Sep 26 at 05:27

Ivan's gravatar image

Ivan
52

edited Sep 26 at 05:29


Another way:

buffer.append2(&inputBuffer[0], (unsigned long)inputBuffer.size());
link

answered Nov 01 at 10:53

Ivan's gravatar image

Ivan
52

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×65

Asked: Sep 26 at 05:27

Seen: 275 times

Last updated: Nov 01 at 10:53

powered by OSQA