Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
GenericPacker
//Title of this code #include <iostream> class StreamAccessor { public: void beginWrite() { //this->lockWrite(); std::cout<<"Begining to write...\n"; } void endWrite() { //ipc.send(); //this->unlockWrite(); std::cout<<"Sending data...\n\n"; } void push() { } void push(int arg) { std::cout<<"Int pushed: "<<arg<<'\n'; } void push(const char *arg) { std::cout<<"String pushed: "<<arg<<'\n'; } template<class T> void push(T *arg, size_t size) { std::cout<<"Buffer pushed: "<<arg<<" with size: "<<size<<'\n'; } template<class T> void push(T &arg) { std::cout<<"We don't have a known way to push this!"<<arg<<'\n'; } template<class T, class... Args> void push(T &arg, Args... args) { this->push(arg); this->push(args...); } template<class... Args> void send(int proxyType, int opCode, Args... args) { this->beginWrite(); this->push(proxyType); this->push(opCode); this->push(args...); this->endWrite(); } }; struct mystruct { int a, b; }; int main() { StreamAccessor stream; stream.send(1, 2); stream.send(1, 2, 2, 3, 1); stream.send(2, 3, "this", "and this"); void *p = new int[50]; size_t size = 50 * sizeof(int); stream.send(2, 4, 3, 5, p, size); mystruct val; stream.send(1, 4, &val, sizeof(val)); }
run
|
edit
|
history
|
help
0
copy_30-Seconds-of-C++
Following order Indegree
BinTree playground
diamond
segmented sieve
TypeSizeTest
Hii
Вариант универсального указателя.
scope new delete
HeapSort