Category : ambiguous

Consider a simple vector class realization: #include <algorithm> class Vector { public: Vector(int _elementsCount) : elementsCount(_elementsCount) , elements(new float[_elementsCount]) {} ~Vector() { delete[] elements; } Vector(const Vector& rhs) { elementsCount = rhs.size(); elements = new float[elementsCount]; for (int i = 0; i < elementsCount; ++i) (*this)[i] = rhs[i]; } float& operator [](int i) { return ..

Read more

I have classes foo_impl, bar_impl deriving from derived classes foo_derived, bar_derived, and a function that takes in a templated template-parameter: #include <iostream> template <typename T> struct foo_base { T a; }; template <typename T> struct foo_derived: public foo_base<T> { }; struct foo_impl: public foo_derived<int> { }; template <typename T> struct bar_base { T a; }; ..

Read more

(This is kind of related to a previous question.) Core guideline SF.7 gives a good motivation for avoiding to put using namespace directives at global scope in a header file. However, even writing using namespace in a non-global namespace can be problematic. For example: header1.hpp #include <boost/hana/transform.hpp> namespace ab { using namespace boost::hana; inline constexpr ..

Read more

i am trying to compile ustl c++ library with mingw gcc compiler on win10. The 41th line in the C ++ header below was able to solve thanks to this answer, but there is a problem at 43 line. How should I solve it? https://github.com/msharov/ustl/blob/master/fstream.h#L41 // int ioctl (const char* rname, int request, long argument ..

Read more