C++ Logo

std-proposals

Advanced search

Re: [std-proposals] PR: std::allocator<T>::allocate is not freestanding

From: connor horman <chorman64_at_[hidden]>
Date: Sat, 2 Sep 2023 18:40:16 -0400
Keep in mind that operator new is required in freestanding. Having
std::allocator as required would just allow constexpr allocations in
freestanding.
So from that standpoint, std::allocator<T> doesn't really require anything
new of the implementation environment.

On Sat, Sep 2, 2023 at 18:10 Frederick Virchanza Gotham via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Sat, Sep 2, 2023 at 11:00 PM Jens Maurer wrote:
> >
> > In general, the "freestanding" subset of C++ is a library subset
> > to accommodate environments where an operating system might not
> > be available, or that are otherwise constrained. For example,
> > std::cout will probably never be part of freestanding
> > (because e.g. a fridge does not have that).
>
>
> I'm programming an Arduino microcontroller here right now, and I have
> it set up so that I can use 'cout' as follows:
>
> class Flush {} flush;
> std::ostream &operator<<(std::ostream &os, Flush const &f) {
> Serial.flush(); return os; }
> std::ostream &operator<<(std::ostream &os, String const &s) { return
> os << s.c_str(); }
> extern "C" int _write(int const fd, char const *const ptr, int const len)
> {
> (void)fd;
> return Serial.write(ptr, len);
> }
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2023-09-02 22:40:29