Category : ambiguous

(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

I have a class that defines an overloaded method that I need to mock. The issue is, the two overloads both take only one argument and GMock seems to think the call is ambiguous. Here is a small example demonstrating the problem (oversimplified for the sake of demonstration): #include <gmock/gmock.h> #include <gtest/gtest.h> #include <iostream> #include ..

Read more

I have the following classes: class ServoPart { protected: virtual void doJob(byte* job) = 0; private: bool moving; Servo servo; }; // the following classes only have a constructor so I can use two ServoParts to inherit from class Major: public ServoPart {}; class Minor: public ServoPart {}; class Arm: public Major, public Minor { ..

Read more

template <typename, typename> struct my_struct; template <typename T> struct my_struct<T, tuple<>> { using type = int; }; template <typename T, typename Head, typename …Tail> struct my_struct<T, tuple<Head, Tail…>> { using type = bool; }; template <typename T, typename Head, typename … Tail> using my_struct_t = typename my_struct<T, tuple<Head, Tail…>>::type; Above is the type trait I ..

Read more