Date: Sat, 11 Jan 2025 23:17:30 +0000
Yes, I have something like your example in mind.
-----Original Message-----
From: Std-Proposals <std-proposals-bounces_at_lists.isocpp.org> On Behalf Of Frederick Virchanza Gotham via Std-Proposals
Sent: Friday, January 10, 2025 6:42 PM
To: std-proposals_at_[hidden]
Cc: Frederick Virchanza Gotham <cauldwell.thomas_at_gmail.com>
Subject: Re: [std-proposals] Providing information about data structures to the compiler
On Fri, Jan 10, 2025 at 3:16 PM Ehsan Amiri wrote:
>
> It may make sense to have a mechanism to provide such information to
> the compiler (for example, a class implements a vector-like data
> structure. Certain functions of the class will add/remove elements or
> reallocate memory, etc.).
I'm pretty clueless about this stuff . . . but are you saying we'd write a class something like as follows?
template<typename T>
class MyVector [[classtype=container]] {
public:
void emplace_back(T const &) [[container_add, might_realloc]]
{
. . .
}
};
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]pp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
-----Original Message-----
From: Std-Proposals <std-proposals-bounces_at_lists.isocpp.org> On Behalf Of Frederick Virchanza Gotham via Std-Proposals
Sent: Friday, January 10, 2025 6:42 PM
To: std-proposals_at_[hidden]
Cc: Frederick Virchanza Gotham <cauldwell.thomas_at_gmail.com>
Subject: Re: [std-proposals] Providing information about data structures to the compiler
On Fri, Jan 10, 2025 at 3:16 PM Ehsan Amiri wrote:
>
> It may make sense to have a mechanism to provide such information to
> the compiler (for example, a class implements a vector-like data
> structure. Certain functions of the class will add/remove elements or
> reallocate memory, etc.).
I'm pretty clueless about this stuff . . . but are you saying we'd write a class something like as follows?
template<typename T>
class MyVector [[classtype=container]] {
public:
void emplace_back(T const &) [[container_add, might_realloc]]
{
. . .
}
};
--
Std-Proposals mailing list
Std-Proposals_at_[hidden]pp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2025-01-11 23:18:29