ambiguity

C++ Function Overloading Similar Conversions

I'm getting an error which says that two overloads have similar conversions. I tried too many things but none helped. Here is that piece of code CString GetInput(int numberOfInput, BOOL clearBuffer = FALSE, UINT timeout = INPUT_TIMEOUT); CString GetInput(int numberOfInput, string szTerminationPattern, BOOL clearBuffer = FALSE, UINT tim...

How to rewrite this nondeterministic XML Schema to deterministic?

Why this is non-deterministic and how to fix it? <xs:element name="activeyears"> <xs:complexType> <xs:sequence minOccurs="0" maxOccurs="1"> <xs:sequence minOccurs="0" maxOccurs="unbounded"> <xs:element ref="from" minOccurs="1" maxOccurs="1"/> <xs:element ref="t...

How to make an ambiguous call distinct in C++?

void outputString(const string &ss) { cout << "outputString(const string& ) " + ss << endl; } void outputString(const string ss) { cout << "outputString(const string ) " + ss << endl; } int main(void) { //! outputString("ambigiousmethod"); const string constStr = "ambigiousmethod2"; //! outputString(constStr); } //...

Forward declaring a function that uses enable_if : ambiguous call

I have some trouble forward declaring a function that uses boost::enable_if: the following piece of code gives me a compiler error: // Declaration template <typename T> void foo(T t); // Definition template <typename T> typename boost::enable_if<boost::is_same<T, int> >::type foo(T t) { } int main() { foo(12); return 0; } Wh...

Ambiguous overload accessing argument-less template functions with variadic parameters

Yeah, the title can scare babies, but it's actually quite straightforward. I am trying to store a function pointer to a specialized template function, namely boost::make_shared (boost 1.41), as illustrated: boost::shared_ptr<int> (*pt2Function)() = boost::make_shared<int>; However, it won't compile (GCC 4.4.1) due to the fact that bo...

boost::intrusive_ptr constructor ambiguity using a class' 'this' pointer

The offending code: template<typename T> class SharedObject { public: typedef boost::intrusive_ptr<T> Pointer; typedef boost::intrusive_ptr<T const> ConstPointer; inline Pointer GetPointer() { return Pointer(this); //Ambiguous call here } inline ConstPointer GetPointer() const { return ConstPointer(this); } ... ...

C++ My first template ever

Ok, which is the best to avoid ambiguity here? template <class T> inline void swap(T &a, T &b) { T c; c = a; a = b; b = c; } /* blah blah blah (inside of a function:) */ for (itv = vals.begin(); itv != vals.end(); ++itv) { if (at < (*itv)) { swap(at, (*itv)); } if (at % (*itv) == 0) atadd = false; } /* blah blah blah */ Ca...

Object construction/Forward function declaration ambiguity

Observation: the codes pasted below were tested only with GCC 4.4.1, and I'm only interested in them working with GCC. Hello, It wasn't for just a few times that I stumbled into an object construction statement that I didn't understand, and it was only today that I noticed what ambiguity was being introduced by it. I'll explain how to ...

Java do while, while

Hello, what behaviour can I expect when I run this code: do while(testA) { // do stuff } while(testB); Will it behave like: do { while(testA) { // do stuff } } while(testB); Or: if(testA) { do { // do stuff } while(testA && testB); } Or something totally unexpected? I ask this question...

Objects with the same attributes and methods belongs to the same class?

Objects with the same attributes and methods belongs to the same class? Can't I declare two identical classes with the same methods and attributes, instanciate them and have "objects with the same attributes and methods belonging to different classes"? Can't I declare a class A and a sub-class B (children of the class A) both with the ...

what is the equivalent of object in C# for objective C?

In c# I can declare object o; then I can assign o=(float)5.0; or o="a string." Is there an equivalent for Objective-C? I tried to use id but it does not take primitive type like float or integer. Thanks for helping. ...

JavaCC: How can one exclude a string from a token? (A.k.a. understanding token ambiguity.)

Hello, everyone! I had already many problems with understanding, how ambiguous tokens can be handled elegantly (or somehow at all) in JavaCC. Let's take this example: I want to parse XML processing instruction. The format is: "<?" <target> <data> "?>": target is an XML name, data can be anything except ?>, because it's the closing tag...

Properties.Settings Ambiguity after adding LINQ to SQL

I have recently linked a database to my C# service by creating a LINQ to SQL item in my solution. Everything was fine and dandy as I was continuing to code, but then I suddenly noticed that there where 16 Ambiguity errors. e.g. Ambiguity between 'EmailService.Properties.Settings.defaultInstance' and 'EmailService.Properties.Settings.d...

Explanation of ambiguity in function overloading for this example in C++.

I'm reading Stroustrup's book, the section on overloading and related ambiguities. There's an example as follows: void f1(char); void f1(long); void k(int i) { f1(i); //ambiguous: f1(char) or f1(long) } As the comment states, the call is ambiguous. Why? The previous section in the book stated 5 rules based on matching formal...

c++ pair template struct declaration ambiguity!

In definition of pair class in c++ there are two typedefs. what are they for? there are no use of them in the code! template <class T1, class T2> struct pair { typedef T1 first_type; typedef T2 second_type; T1 first; T2 second; pair() : first(T1()), second(T2()) {} pair(const T1& x, const T2& y) : first(x), second(y) {} t...

Why does Oracle SQL mysteriously resolve ambiguity in one joins and does not in others

Hello. I'm an Oracle 10g user. I had to write some SQL queries, and spotted a mysterious (as I see it) behaviour. Let's pretend we have a table, which is able to join itself in some kind of simple two-level tree structure. The next query gives me "ambiguity error", which is expected: select title from table1 left join table1 on c...

does adding a dummy parameter to constructors of a class to solve calling ambiguity, violate any rule ?

take following class and two object definitions: class Rect{ public: enum centimeter; enum meter; Rect(double len,double wid,enum centimeter){ length=(len/100); width=(wid/100); } Rect(int len,int wid,enum meter){ length=len; width=wid; } //rest of implementation private: double length;//in meters double ...

Can an Android View's id be safely shared across multiple Activities?

Say I have two Activities in an Android application, EditPerson and EditEmployee. It would seem natural to have the EditPerson Activity be a base class for the EditEmployee Activity and define methods that marshal data to and from the Views defined in the layout. The EditPerson Activity's implementation would push (for example) the "Na...

C# ambiguity error when properties are used

I've recently started learning C#. I just learned about properties and decided to make a simple program in order to understand them more. this is the code I wrote: class Dog { private int weight; private string colour; public string colour { get; set; } public Dog(int theWeight, string theColour) { weight =...

VB.NET: Ambiguous class name error when no ambiguity exists.

A client of ours reported that when trying to use our .NET .DLL in VB.NET they receive the error: error BC31429: 'OurClass' is ambiguous because multiple kinds of members with this name exist in namespace 'our.company.nspace' I've also been able to reproduce the error with a dummy project containing the single line of Dim x as our...