Category : alias

I am writing a class Sequence. Its constructor takes two templated vector iterators as arguments. Here is the code: template <class T> using ConstIterator_t = typename std::vector<T>::const_iterator; template <class T> class Sequence{ public: Sequence(ConstIterator_t start, ConstIterator_t end); //rest of the code }; When I compile the code it shows me this error: expected ‘)’ before ..

Read more

I have a legacy interface that has a function with a signature that looks like the following: int provide_values(int &x, int &y) x and y are considered output parameters in this function. Note: I’m aware of the drawbacks of using output parameters and that there are better design choices for such an interface. I’m not ..

Read more

I’m using a Bridge pattern where the interface forward-declares an Impl class without knowing it’s definition. The class definition uses just a pointer to this implementation, so no definition is needed here: // interface.h class Interface1 { public: void method(); private: class Impl; Impl *impl; }; class Interface2 { public: void method(); private: class Impl; ..

Read more