implicit-conversion

Implicit conversion not happening

Hello again :) The last question I asked was something I stumbled upon when trying to understanding another thing... that I also can't understand (not my day). This is quite a long question statement, but at least I hope this question might prove useful to many people and not only me. The code I have is the following: template <typen...

Why const for implicit conversion?

After extensive reading of ISO/IEC 14882, Programming language – C++ I'm still unsure why const is needed for implicit conversion to a user-defined type with a single argument constructor like the following #include <iostream> class X { public: X( int value ) { printf("constructor initialized with %i",value); } } void impl...

Question about Scala implicit conversions Non-Ambiguity Rule

Hello. Could anybody explain me following situation with Scala implicit conversions mechanism. There is a code: object Main { implicit val x:Int => String = v => "val" implicit def y(v:Int) = "def" def p(s:String) = print(s) def main(args: Array[String]): Unit = { p(1) } } This code prints "val". But when I comment ...

Overhead of "boxing" primitive types via implicits in Scala

Suppose I want to have a class like Java Date. Its only data member is a long which represents the milliseconds since 1970. Would/Could it be of any performance benefit of just making a new Scala type: type PrimitiveDate = Long Then you can add methods by using implicit conversion, like it is done for int with RichInt. Does this "box...

mysql datetime comparison

For example the following query works fine: SELECT * FROM quotes WHERE expires_at <= '2010-10-15 10:00:00'; But this is obviously performing a 'string' comparison - I was wondering if there was a function built in to MySQL that specifically does 'datetime' comparisons. ...

Operator-function + with two implicit casts doesn't work

hi, I'm trying to port some parts from ginac (www.ginac.de) to C#. But I encountered this: class Program { static void Main(string[] args) { symbol s = new symbol(); numeric n = new numeric(); ex e = s + n; // "Operator + doesn't work for symbol, numeric" } } class ex { //this should be alre...