1,130 questions
1
vote
2
answers
118
views
Can't convert Supplier<S> into Supplier<?>
I have a very simple Java class that looks like this
public class StatementRegister {
public static final Map<String, Supplier<Statement<?>>> registry = new HashMap<>();
...
1
vote
2
answers
97
views
C++ template class as a member in a normal class
I'm creating GPIO abstraction driver for stm32. There should be a class with register accesses and another class that holds a reference to it. In that way the class holding a reference has no idea ...
2
votes
1
answer
113
views
How to implement abstraction/encapsulation; like a generic/opaque struct that holds a platform specific window
typedef struct
{
WindowData data;
bool vsync;
} Window;
typedef struct
{
Window window;
GLFWwindow *native_window;
} WindowsWindow;
Window *windowCreate(const WindowProperties props,...
0
votes
2
answers
72
views
How to extend ThemeData and override a property type
I am using ThemeData's "extensions" property:
ThemeData(
...
extensions: <ThemeExtension>[
CustomThemeExtension(
...
),
...
),
by looking at its definition: Iterable&...
3
votes
2
answers
237
views
How to write an abstraction in Rust with multiple implementations
In my application I want to have an EventPersister trait that defines an abstraction of persisting events, then have various implementations that, for example, persist events in memory, in the file ...
-2
votes
2
answers
129
views
Recursively instantiating the classes inside an object
I want to activate, via reflection automatically and recursively all the nested classes inside a class I am instantiating. Here is the template of what I am trying to do, but I do not know how to make ...
6
votes
1
answer
491
views
How can I determine the type of a tuple's elements directly from its type name in Swift?
I have been exploring different abstractions in Swift, and I found myself stumped on how to determine the type of a tuple's element from its own type. I know the compiler and Xcode are quick to ...
-1
votes
1
answer
60
views
Generic types in abstract classes
I am looking for a C# solution that allows me to create a base class (AParam) whose inherited classes (Param) can be generic in order to implement different, type-dependent versions of a function (...
-1
votes
1
answer
60
views
dynamic size SoA_container with AoS Access
I found this idea in the paper Abstraction for AoS and SoA Layout in C++ by Robert Strzodka (PDF) for applying a AoS (Array of Strucures) access to an SoA (Structure of Arrays) container without ...
0
votes
1
answer
238
views
How do I create an abstract or base Notifier class in Riverpod?
I have multiple notifiers with similar search and other logic, the only difference being the API call. How can I abstract that logic out? And reuse my Notifier in multiple places?
Example :
...
2
votes
1
answer
86
views
C++ factory of a container type without defining the container element type
Based on this topic, I wonder if it would be possible to have a factory class that would provide a container type, without defining the type of element of the container.
Something like:
template <...
-1
votes
1
answer
61
views
Abstraction vs Encapsulation , not the bookish definition , real world examples
I have searched about this topic everywhere that what's the difference between abstraction and encapsulation
, even one of the most voted stack overflow question , but at the end it seems confusing
...
1
vote
2
answers
201
views
SYCL NDRange and Hierarchical: Why one of them is not enought?
SYCL offers NDRange and Hierarchical kernel parallelism abstractions.
My questions:
Is it true to claim that NDRange better mapped into GPUs hardware and Hierarchical parallelism better mapped into ...
-1
votes
2
answers
64
views
Efficient way to abstract multidimensional ArrayList to Collection
I have a class that returns an ArrayList of ArrayLists. I would like to return a Collection of Collections to abstract the output datatype.
With a standard ArrayList, its easy - just define the return ...
0
votes
1
answer
137
views
How can I programmatically decide what class to create an object as?
I want to write code to communicate with encoders of different positioning styles (absolute vs. relative). The idea I have is to create a base class that has things common to all encoders. Then there ...