Questions tagged [ambiguity]

Ambiguity can refer to two related concepts: 'ambiguous calls' and 'ambiguous grammars'.

400 questions
7
votes
4 answers

Solving design involving multiple inheritance and composite classes in c++

I have struggled with this design problem for some time. I will do my best to explain what I am trying to do and the various approached that I have seen, what I am trying and why. I work in a scientific computing environment where I deal with the…
PhiloEpisteme
  • 857
  • 3
  • 8
  • 19
7
votes
2 answers

How to avoid shared_ptr ambiguity? (stl vs boost)

Possible Duplicate: Why is ‘using namespace std;’ considered a bad practice in C++? I've used stl's shared_ptr many places in my code and I have used the following using statement anywhere that I have used shared_ptr: using namespace…
B Faley
  • 17,120
  • 43
  • 133
  • 223
7
votes
3 answers

JBehave ambiguous step

Say I have: @Given("first name is $firstName") @Given("first name is $firstName and last name is $lastName") The following step would be marked as ambiguous: Given first name is John and last name is Smith Without using quotes to surround the…
6
votes
2 answers

Why does C++ see this as ambiguous function reference

Why might my compiler see the following GetLength function pointer as ambiguous pseudo-code: size_t GetLength(char*); size_t GetLength(wchar_t*); struct ITEM { }; double GetLength(ITEM*); CString GetInfo(ITEM * item, std::function
Mordachai
  • 9,412
  • 6
  • 60
  • 112
6
votes
1 answer

Solve ambiguity between itself due to compiler generated copies?

General Working on a mod for a game using the Unity Engine. The problem I'm trying to attach to the activeSceneChanged event with this code: SceneManager.activeSceneChanged += OnSceneChanged; This results in the error: CS0229 Ambiguity between…
icecub
  • 8,615
  • 6
  • 41
  • 70
6
votes
1 answer

Ambiguous Struct Constructors in D

I'm having some trouble understanding how to deal with ambiguity of constructors in D. struct mydta { int a = 2; int b = 3; this(int c) { a = c / 2; b = c * 2; } this(float c) { a = cast(int) c / 2; …
hiddensunset4
  • 5,825
  • 3
  • 39
  • 61
6
votes
8 answers

Ambiguity in number comparisons (in C)?

I'm not too familiar with programming in C (I've only done a few small projects in the language), however, my professor said something about it's behavior today that left me a bit confused. What he said was that this code will sometimes not print…
Casey Patton
  • 4,021
  • 9
  • 41
  • 54
6
votes
4 answers

Overriding Qualified Virtual Methods

I have C++ class with multiple parents; each parent defines a function with a common name but a different purpose: class BaseA { virtual void myFunc(); // does some task }; class BaseB { virtual void myFunc(); // does some other…
John
  • 127
  • 2
  • 4
6
votes
1 answer

Ambiguous template instantiation

Can someone explain the ambiguity here? template struct thing; template struct thing { thing(int&, Rest&...) { } }; template struct thing { …
prestokeys
  • 4,817
  • 3
  • 20
  • 43
6
votes
3 answers

Ambiguous partial template specialization

I've got a trait class which I need to specialize (and partial-specialize) many times. Some partial specializations overlap: template< typename T > struct C { }; template< typename T1, typename T2 > struct TRAIT { }; template< typename T > struct…
peoro
  • 25,562
  • 20
  • 98
  • 150
6
votes
4 answers

Where is the ambiguity in this Java method call?

I am getting a "reference to make is ambiguous" compiler error that I don't understand. I have these two methods public static T make(String name, Class parentClass, boolean rethrowRuntimeExceptions, …
Zack
  • 6,232
  • 8
  • 38
  • 68
6
votes
2 answers

Equivalent implicit operators: why are they legal?

Update! See my dissection of a portion of the C# spec below; I think I must be missing something, because to me it looks like the behavior I'm describing in this question actually violates the spec. Update 2! OK, upon further reflection, and based…
Dan Tao
  • 125,917
  • 54
  • 300
  • 447
6
votes
2 answers

Sorting a list when the comparison between any two elements may be ambiguous?

I'm trying to optimize a sort for an isometric renderer. What is proving tricky is that the comparitor can return "A > B", "A < B", or "the relationship between A and B is ambiguous." All of the standard sorting algorithms expect that you can…
6
votes
3 answers

Ambiguous call of a copy constructor in C++ caused by multiple inheritance

I'm having a problem with a certain task, it's an excercise, not a real program. The task is to define a copy constructor of structure D that behaves in the exactly same way as a copy constructor generated by the compliler would. class…
6
votes
3 answers

Ambiguous method call with Action parameter overload

I encountered some unexpected compiler behaviour when calling overloaded method with different Action variations. Let's say I have this class Test and I'm creating its instance in the CallTest constructor. public class Test { public…
zen
  • 353
  • 2
  • 12