Increasing usage for C++ new operators based on data model indexes?
-
@elfring said in Increasing usage for C++ new operators based on data model indexes?:
Is your
ball
known (i.e. defined) when the models are developed?Models can be implemented in the way that this can happen.
No they can't.
How do you think about to discuss concrete consequences for passing a pair of integer types (row, column) to a “placement new”?
I don't. I already stated directly and quite clearly what is needed to discuss - a proof of concept in code.
-
I'll try to explain in layman terms why we are a bit frustrated by this and the related topics with a small parallel.
Imagine you walk into a car factory and say to the manager: "you should put wings on your cars"
The manager answers: "what would that achieve?"
you - "do you know what wings are?"
manager - "yes but I don't see how they can be useful on a car"
you - "wouldn't it be cool to have wings on the cars?!"
manager - "yes but wings are not enough to make the cars fly"
you - "that's right, you need to also make the cars fly"
manager - "fine but how am I supposed to do that?"
you - "It's something you should think about"
manager - "well if you don't have any idea how to make the cars fly, I don't see why i should put wings on my cars"
you - "wouldn't it be cool to have wings on the cars?!"This is exactly what you are doing to us!
-
No they can't.
Why do you try to exclude the possibility that various data can be loaded into models?
… - a proof of concept in code.
Do any other aspects hinder you to discuss software design possibilities around returning pointers (or C++ references) from functions after a few parameters were passed?
-
@elfring said in Increasing usage for C++ new operators based on data model indexes?:
Why do you try to exclude the possibility that various data can be loaded into models?
I don't, and it already can through
QVariant
.Do any other aspects hinder you to discuss software design possibilities around returning pointers (or C++ references) from functions after a few parameters were passed?
No. I want you to meet the burden or proof - if you claim something, have the balls to back it up. You claim to have an idea that's better than the currently available one, put it on paper, so to speak, and we can discuss it.
-
You claim to have an idea that's better than the currently available one,
I got another software development idea which I find useful.
put it on paper,
I have described it in a few variants for this feature request already.
so to speak, and we can discuss it.
Another approach
- Function input:
Parameters like row and column - Function output:
- Pointer ⇒ How likely is it that this function variant can be called “C++ new operator”?
- C++ reference ⇒ Would you like to use direct access for an object?
- Function input:
-
@elfring said in Increasing usage for C++ new operators based on data model indexes?:
I got another software development idea which I find useful.
Good. Make a proof of concept for it as well. We can discuss it after that.
I have described it in a few variants for this feature request already.
You have not written anything tangible for us to discuss. You can describe it all night long, but at the end of the day we have to have something to base the discussion on. Some kind of proposed code that is to replace the current approach and then we can compare and argue.
Another approach
Finish one of the approaches before jumping into the next one.
-
@elfring said in Increasing usage for C++ new operators based on data model indexes?:
Can you discuss the programming interface design for a single function in terms of concepts (without referring to source code examples)?
No. There's no interface design for single functions, plus if it's only one function, just write it down for us and we can take a stab at the issue.
-
There's no interface design for single functions,
I find this view questionable.
plus if it's only one function, just write it down for us and we can take a stab at the issue.
template<typename model_item, typename model_index> model_item * get_item_pointer(model_index mx);
Can you discuss such a function template declaration better?
-
@elfring said in Increasing usage for C++ new operators based on data model indexes?:
I find this view questionable.
That's your right. I will not spend any time arguing it either way.
Can you discuss such a function template declaration better?
That's a declaration, moreover it's a template, so this declaration doesn't mean anything to me. I have no idea what it is to be doing. Neither can I know how this
model_item
is to be handled inside the model, nor whatmodel_index
is, since it's a generic template type. Additionally there's no clarity of how this function is to be integrated into theQObject
derived models, because there are limitations of whatmoc
can parse.Give us some solutions to these problems and I'd be happy to pitch in with ideas, critiques and even work. But only if you take the time to actually prepare something that can reasonably be discussed.
Vague notes about theoretical constructs are not acceptable.
-
I have no idea what it is to be doing.
Your understanding of this programming interface (and my API proposal) might be still incomplete at the moment.
But I am confident that you know already what such a function should be doing: You get a pointer for an object based on the provided input data.…, since it's a generic template type.
Can you become used to work with templates for software development and involved concepts?
-
@elfring said in Increasing usage for C++ new operators based on data model indexes?:
Your understanding of this programming interface (and my API proposal) might be still incomplete at the moment.
That is for sure, as you have not proposed an API.
But I am confident that you know already what such a function should be doing: You get a pointer for an object based on the provided input data.
Humor me.
Can you become used to work with templates for software development and involved concepts?
I already am.
-
@elfring said in Increasing usage for C++ new operators based on data model indexes?:
A function template declaration can be a succinct description for an application programming interface, can't it?
No, it can't. Not even by a long shot.
-
@elfring said in Increasing usage for C++ new operators based on data model indexes?:
How can your view fit to the C++ standard template library?
It fits perfectly. The STL is comprised by many, many, many functions and classes. They even have bodies too, unlike the one declaration you wrote.
-
The STL is comprised by many, many, many functions and classes.
My proposal can eventually grow into another template library, can't it?
They even have bodies too, unlike the one declaration you wrote.
The desired implementation can evolve further if the required concepts will be generally accepted.
-
@elfring said in Increasing usage for C++ new operators based on data model indexes?:
My proposal can eventually grow into another template library, can't it?
Only if you write the library, or at least the core of it.
The desired implementation can evolve further if the required concepts will be generally accepted.
The only thing that's going to be generally accepted is written code, i.e. an implementation. Since you have written none, none is going to evolve.
-
The only thing that's going to be generally accepted is written code, i.e. an implementation.
Some software designers expect the development of specific concepts before concrete programming.
Template programming can help to achieve a safer coding style.