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.
1
vote
0answers
101 views
Software Design, Generic Programming, Physical Devices, and Algorithms in C++ [closed]
I often have data that in some contexts I want to handle uniformly, but in other contexts I wish to differentiate it. For example, I could have a vector that is series of angles or a series of ...
5
votes
2answers
393 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
356 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
265 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
225 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 ...
2
votes
0answers
121 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 ...
2
votes
1answer
300 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
1k 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 ...
0
votes
1answer
170 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
1k 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 ...