Questions tagged [convenience-methods]

Convenience methods are shorthand abstractions which invoke another method by implicitly passing in default argument(s) for a common use case

Convenience methods are intended to encapsulate the verbosity of an existing API into a single expression by aliasing a method call or set of method calls with default arguments to a new method which represents a specific operation.

References

55 questions
0
votes
1 answer

DLL management for C++ with MinGW?

I recently decided to take a look at 2D graphics with C++, using MinGW on Windows 7. Since I was only going to need 2D graphics any library would be viable more or less (OpenGL, SDL, etc..). I decided to take a quick look at a few and check how easy…
Wingblade
  • 9,585
  • 10
  • 35
  • 48
0
votes
0 answers

Convenience method(s) for setting OpenCL kernel arguments?

It seems to me that a lot of the OpenCL kernel argument setting can be streamlined. The most rudimentary thing one can think of is implementing: clSetKernelArgs(cl_kernel kernel, unsigned num_args, ...) and then for each argument can one can read…
einpoklum
  • 118,144
  • 57
  • 340
  • 684
0
votes
3 answers

Why doesn't bash history expansion work in functions?

When I'm programming, I'll find myself cycling through the same three shell commands, e.g: vim myGraphic.cpp g++ -lglut -lGLU myGraphic.cpp -o prettyPicture ./prettyPicture In order to avoid hitting the uparrow key thrice every time, I put the…
seewalker
  • 1,123
  • 10
  • 18
0
votes
5 answers

Class design: allow a class to be used both as an object and also supply public static methods

I have a silly, little class "FileSystemSize" which can be used both as an object and also via public, static methods. The output is similar, but not identical in each case. The class was intially static, but I added the possibility to initialize it…
Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
0
votes
1 answer

How is for...of used in other languages which made it relevant for ECMAScript-6?

I noticed for...of loops were added to the ECMAScript-6 proposal, but have never heard of them until now. What's the typical use case for them?
0
votes
2 answers

Convenient wrapper for plots, lines, and points

One of the things that most bugs me about R is the separation of the plot, points, and lines commands. It's somewhat irritating to have to change plot to whatever variant for the first plot done, and to have to replot from scratch if you failed to…
Fhnuzoag
  • 3,810
  • 2
  • 20
  • 16
0
votes
1 answer

Is it possible to type style sheets in Firebug fast and convenient ? (as in Aptana)

For example, when I type the first of the parenthesis in Aptana, the second appears immediately, then I need only to press enter, it makes some white space, and I can type further. A small feature that saves a lot of time! But in Firebug it is not.…
Aleksey
-1
votes
2 answers

Can a class inherit convenience inits even if there is designated inits

I've got the following classes: class A { let age:Int init(age: Int) { self.age = age } } extension A { convenience init?(ageString: String) { guard let age = Int(ageString) else { return nil} …
xarly
  • 2,054
  • 4
  • 24
  • 40
-1
votes
1 answer

Whats wrong with my convenience initializer when I attempt to call self.init?

I wrote the code below. The error I'm getting is at the end of my convenience initializer when I attempt to call self.init. What's wrong with my logic or syntax? Or how would I debug this? The error Xcode is giving is "cannot invoke with an…
Laurence Wingo
  • 3,912
  • 7
  • 33
  • 61
-1
votes
1 answer

Replicating convenience implementations in Swift

I am attempting to understand the following code and how you would convert it to Swift. Specifically, I understand this adds an instance method you can call on an instance of CIImage. My question is, how you can do the same thing in a Swift…
Jordan H
  • 52,571
  • 37
  • 201
  • 351
1 2 3
4