Category : c++14

Few days back i had started learning c++ and recently i had came across a topic dynamic memory allocation. Where i learned that if i have to allocate elements in an array then things will work something like: int sizeofarray; cin>>sizeofarray; int *nameofdynamicarray; nameofdynamicarray=new int[sizeofarray]; for(int i=0;i<sizeofarray;i++) { cin>>nameofdynamicarray[i]; } My question is: int main(){ ..

Read more

I am trying to write a code that invokes a lambda with input arguments extracted from a variadic set of tuples. However, my attempt does not compile: #include <iostream> #include <tuple> #include <utility> #include <type_traits> template <typename …> struct first_of; template <typename T, typename … Args> struct first_of<T, Args…> { using type = std::decay_t<T>; }; ..

Read more

I used to write code like this: class SomeInterface { public: virtual void doThings() = 0; virtual void run() = 0; }; class OtherInterface { public: virtual void doStuff() = 0; virtual void run() = 0; }; class ConcreteClass : public SomeInterface, public OtherInterface { public: virtual void doThings() { … } virtual void doStuff() ..

Read more