Questions tagged [implicit-methods]

6 questions
23
votes
2 answers

Deleting copy constructors and copy assignment operators. Which of them are essential?

I have a use case that my object must not be copied in any way. I have written an exaggerated complete list of copy constructor and copy assignment operator deletions below. There are so many of them that I can't make sure which ones to use, and…
4
votes
2 answers

Recursively using implicit methods in Scala

I'd like to define some implicit methods for arrays of doubles to make my code cleaner. Ideally, they would look like this: type Vec = Array[Double] implicit def enrichVec(v: Vec) = new { def /(x: Double) = v map (_/x) def *(u: Vec) = (v zip…
davidsd
  • 771
  • 4
  • 18
4
votes
2 answers

invokedynamic and implicit methods

As I understand from reading this post about the new invokedynamic bytecode instruction in JDK 7, it makes it possible to call methods on the objects which are not statically defined in the object's class and have those method calls be resolved to…
Abhinav Sarkar
  • 23,534
  • 11
  • 81
  • 97
3
votes
3 answers

Implicit move vs copy operations and containment

I am struggling to understand implicit move operations when a class has a member whose move operations were not defined: int main() { struct A // no move: move = copy { A() = default; A(const A&) { cout <<…
Maestro
  • 2,512
  • 9
  • 24
0
votes
1 answer

Java implicitly calls intValue when passing Integer as argument

So I came across a bug caused by following example: I have static method private static Foo findFoo(int id) { //we use id here not important } Then I used it inside another method like private static updateFoo(final Integer id, final String…
0
votes
1 answer

Implicit/Backward Euler for DAE

I have a question regarding implicit Euler. I know how to compute implicit Euler method but my problem is how to use it on DAE ( differential algebraic equation). I obtained a correct solution after I applied index reduction on my original DAE and…
user4828513