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) { if (std::is_enum<T>::value) this->push((int)arg); else { 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(Args... args) { this->beginWrite(); this->push(args...); this->endWrite(); } }; struct mystruct { int a, b; }; enum PROXY_TYPE { PROXY_TYPE_EGL, PROXY_TYPE_GLES, PROXY_TYPE_WAYLAND, PROXY_TYPE_GRALLOC }; int main() { StreamAccessor stream; stream.send(PROXY_TYPE_EGL, 2); stream.send(PROXY_TYPE_WAYLAND, 2, 2, 3, 1); stream.send(PROXY_TYPE_GRALLOC, 3, "this", "and this"); void *p = new int[50]; size_t size = 50 * sizeof(int); stream.send(PROXY_TYPE_EGL, 4, 3, 5, p, size); mystruct val; stream.send(PROXY_TYPE_GLES, 4, &val, sizeof(val)); }
run
|
edit
|
history
|
help
0
CirclQ
მატრიცა#2
st_match
1
FunTemp
Memory_test
cppPyGuessTheNum2
decode
my template
PrePostIncrOp