Replaced instances of resize&memcpy with append, which gives a noticeable performance boost. fr::Packet::operator<<(const char *str) no longer converts str into an std::string before adding it, removing an unneeded copy. fr::Packet::clear no longer calls erase, should result in more of the internal buffer remaining allocated. Framing for std::vector's has been changed from a uint64_t to a uint32_t (breaking change for packet framing!)
28 lines
525 B
C++
28 lines
525 B
C++
#include <iostream>
|
|
#include <thread>
|
|
#include <atomic>
|
|
#include <mutex>
|
|
#include "frnetlib/Packet.h"
|
|
#include "frnetlib/TcpSocket.h"
|
|
#include "frnetlib/TcpListener.h"
|
|
#include "frnetlib/SocketSelector.h"
|
|
#include "frnetlib/HttpRequest.h"
|
|
#include "frnetlib/HttpResponse.h"
|
|
|
|
enum Enum : uint32_t
|
|
{
|
|
E1 = 0,
|
|
E2 = 1,
|
|
E3 = 2,
|
|
};
|
|
|
|
size_t get_vector_size(const std::vector<int> &vec)
|
|
{
|
|
return vec.size();
|
|
}
|
|
|
|
int main()
|
|
{
|
|
std::vector<int> source{1, 2, 3};
|
|
std::cout << get_vector_size(source) << std::endl;
|
|
} |