Generic programming is one method for code reuse. It involves defining a general-purpose data or code structure that can be further specialized to work with concrete types at the location it is used.
4
votes
2answers
164 views
Differences between streams and iterators in C++?
I'm working on code which will provide a generic C++ interface to relational datasets. Some of the data will be in tables in memory (e.g. std::set or std::vector), but some of it will be computed - ...
2
votes
1answer
220 views
Why does the Standard Committee prefer Algorithms to Iterator Facades? [closed]
I was writing a transforming iterator (previously preprocessing iterator), but then I noticed very tight relationship with std::transform(). Then I started wondering if what I'm doing goes "in ...
0
votes
3answers
212 views
Definition of Generic function
1)
Below is a python function summation, that can perform sum of cubes/squares/.., similar operations.
def identity(k):
return k
def cube(k):
return pow(k, 3)
def square(k):
return ...
4
votes
3answers
110 views
Wrapping Controller / ApiController to remove boilerplates
We are aiming to reduce code noise that would be common for all Controllers such as basic CRUD.
public interface IGenericController<T, Y> where T : BaseMaster
{
IEnumerable<T> Get();
...
-1
votes
1answer
65 views
What is the reason behing Tuples instead of HList in akka-http
As I can see in recent releases of akka-http, successor of spray, spray-routing's approach of using shapeless HList was replaced in favor of self-included Tuple
What is the motivation for this ...
1
vote
1answer
62 views
Generic reactive collections of elements
In Visual Studio Color Theme Editor extension if you change some colors, some other related colors will change accordingly. They can become equal to the changed color or be more lighter/darker for ...
-1
votes
2answers
344 views
Java - Does extending a class which itself extends a class which itself… and so on… is healthy..?
NOTE : Feel free to edit the title if it is somewhat different than my question.
In one of our application, we are maintaining a lot of properties inside Instance object. Obviously it's maintained as ...
1
vote
1answer
92 views
Get or infer template type from inherited member
So I have an assignment from college where I have to apply multiple metaheuristics to different problems. I thought that I should make everything as modular and reusable as possible to reuse ...
5
votes
2answers
937 views
Generic Sorting of Lists<>
I have several Lists<> that holds objects of different classes.
List<classA> listA;
List<classB> listB;
List<classC> listC;
//...
List<classM> listM;
The classes do not ...
4
votes
1answer
684 views
Using macros to implement a generic vector (dynamic array) in C. Is this a good idea?
So far I have only done personal projects at home. I hope to get involved in some open source project some time next year. The languages I that have been using the most are C and C++. I have used both ...
1
vote
2answers
361 views
Practical use of generic inheritance and interactions with non-generics?
I've been trying to learn more about generics, and I finally felt that I ran into a situation that it would be more useful to use it instead of only regular classes. Would the following be a practical ...
0
votes
1answer
406 views
Generic object construction - Inherited Classes
Basically I am writing a MSMQ based multi-threaded messaging pattern utility library. It's like a set of components all inherited (directly or indirectly) one class that's called my base component ...
1
vote
0answers
137 views
Why isn't there parallel reduction in the Standard Template Library?
Alexander Stepanov stated in talks and interviews that his realization that eventually lead him to generic programming and the Standard Template Library, was from the case of the parallel reduction ...
3
votes
1answer
424 views
Any programming languages that support Generics exclusively and have no OOP support? [closed]
I am writing a paper on the tension between OOP and Generic programming created by Stepanov. He widely criticizes OOP and says it is "technically flawed" when compared to Generic Programming.
Now I ...
6
votes
2answers
2k views
Writing generic code when your target is a C compiler
I need to write some algorithms for a PIC micro controller. AFAIK, the official tools support either assembler or a subset of C.
My goal is to write the algorithms in a generic and reusable way ...
1
vote
1answer
240 views
Formal definition of “concepts / type system” for parametric types - Where to start?
I would be interested in formally defining (and consequently demonstrating) a "type system" for, well, a type system. More specifically, I would like to explore the idea of what C++ calls concepts for ...
1
vote
4answers
2k views
Are generic programming and OOP mutually exclusive?
I never did generic programming before, being more of a python guy, and generally using OOP. As I moved into generic programming, I faced some issues. I read the FAQ, but I am not satisfied. What I ...