Category : ambiguous

#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; vector<int> parent(N); vector<int> rank(N); // size void make(int v) { parent[v] = v; rank[v] = 1;//"rank" is ambiguous } int find(int v) { if (v == parent[v]) return v; return parent[v] = find(parent[v]); } void Union(int a, int b) { a = find(a); ..

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 ..

I’m writing a code for finding truth table but there’s an ambiguous error for conjunction(bool, bool), but I don’t understand how I can make it right. Does anyone have any tips or comments about this? My code: bool conjunction(bool, bool); bool disjunction(bool, bool); int main() { bool p, q, A, B, C, D; for (int ..

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; }; ..

I am making a c++ library and I want to include fcntl.h in the header (for the permission constants) But I have a function called open, the argument list contains classes that can be casted to the fcntl’s open argument list types. That means when i use #include<fcntl.h> I am getting an ambiguous error. I .. I have a base and derived virtual class, but I encounter ambiguity when the derived implentation inherits from both the base-implementation and the derived interface. I know aliasing can be used to specify that methods and variables from the base implementation. What are good practices for this problem in C++? Source: Windows Que..

So I have a function: void foo(char a = ‘A’, int b = 0) { // code } And I have another one: void foo(int b = 0, char a = ‘A’) { //code } Then if I call foo(), it will return an error because the compiler can’t decide which function to call. So ..