ambiguity

Django model with 2 foreign keys from the same table

巧了我就是萌 提交于 2019-11-27 18:19:44
I wanted a Django model with 2 foreign keys from the same table. It's an event table which has 2 columns for employees: the 'actor' and the 'receiver'. But I get this error: Error: One or more models did not validate: tasks.task: Intermediary model TaskEvent has more than one foreign key to Employee, which is ambiguous and is not permitted. Is there a better way to model this? Thanks I think I'm going to add a TaskEvent_to_Employee table. There will be two records in it, one for each of the two employees related to each TaskEvent . Anyone know an easier workaround? I haven't done this yet, but

template disambiguator

自古美人都是妖i 提交于 2019-11-27 17:48:54
问题 I'm trying to find any information about template keyword used as disambiguator, but there is nothing about that. Probably I'm searching wrong keywords, but there is nothing like .template or ->template in standard. Google shows only GCC problems from different forums, but not really explanation what is it used for. Code like that failed to compile without template keyword on line 11 (on GCC), but I'm not quite sure that this conforms standard. template<typename B> struct S1 { template

C# interface method ambiguity

亡梦爱人 提交于 2019-11-27 15:33:26
问题 Consider the following example: interface IBase1 { int Percentage { get; set; } } interface IBase2 { int Percentage { get; set; } } interface IAllYourBase : IBase1, IBase2 { } class AllYourBase : IAllYourBase { int percentage; int Percentage { get { return percentage; } set { percentage = value; } } } void Foo() { IAllYourBase iayb = new AllYourBase(); int percentage = iayb.Percentage; // Fails to compile. Ambiguity between 'Percentage' property. } In the example above, there is ambiguity

Ambiguous call expression in ANTLR4 grammar

耗尽温柔 提交于 2019-11-27 08:25:52
问题 I have a simple grammar (for demonstration) grammar Test; program : expression* EOF ; expression : Identifier | expression '(' expression? ')' | '(' expression ')' ; Identifier : [a-zA-Z_] [a-zA-Z_0-9?]* ; WS : [ \r\t\n]+ -> channel(HIDDEN) ; Obviously the second and third alternatives in the expression rule are ambiguous. I want to resolve this ambiguity by permitting the second alternative only if an expression is immediately followed by a '(' . So the following bar(foo) should match the

Why is it ambiguous to call overloaded ambig(long) and ambig(unsigned long) with an integer literal?

烂漫一生 提交于 2019-11-27 03:04:21
问题 When compiling void ambig( signed long) { } void ambig(unsigned long) { } int main(void) { ambig(-1); return 0; } I get error C2668: 'ambig' : ambiguous call to overloaded function could be 'void ambig(unsigned long)' or 'void ambig(long)' while trying to match the argument list '(int)' I know I can 'fix' it by saying -1L instead of -1 , but why/how exactly is this considered ambiguous in the first place? 回答1: You're passing an int to this overloaded function. Although human intuition says

C++11: Disambiguate class-member in multiple inheritance

夙愿已清 提交于 2019-11-26 22:59:18
Suppose I have this variadic base class-template: template <typename ... Types> class Base { public: // The member foo() can only be called when its template // parameter is contained within the Types ... pack. template <typename T> typename std::enable_if<Contains<T, Types ...>::value>::type foo() { std::cout << "Base::foo()\n"; } }; The foo() member can only be called when its template-parameter matches at least one of the parameters of Base (the implementation of Contains is listed at the bottom at this post): Base<int, char>().foo<int>(); // fine Base<int, char>().foo<void>(); // error Now

The variable 'MyException' is declared but never used

房东的猫 提交于 2019-11-26 22:51:50
问题 I need to clear this warning : try { doSomething() } catch (AmbiguousMatchException MyException) { doSomethingElse() } The complier is telling me : The variable 'MyException' is declared but never used How can I fix this. 回答1: You can remove it like this: try { doSomething() } catch (AmbiguousMatchException) { doSomethingElse() } Use warning disable like this: try { doSomething() } #pragma warning disable 0168 catch (AmbiguousMatchException exception) #pragma warning restore 0168 {

Compile time warning when using 'Microsoft.Office.Interop.Word._Document.Close'

可紊 提交于 2019-11-26 21:48:24
问题 Anyone know how to solve this warning message? Ambiguity between method 'Microsoft.Office.Interop.Word._Document.Close(ref object, ref object, ref object)' and non-method 'Microsoft.Office.Interop.Word.DocumentEvents2_Event.Close'. Using method group. 回答1: The only way I've managed to resolve the warning is to use an explicit cast: var doc_close = (Microsoft.Office.Interop.Word._Document) _doc; doc_close.Close(); If you already have a using for Microsoft.Office.Interop.Word you can simplify