C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Fwd: Standardised Type Punning API for Wrapper Types

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Tue, 3 Sep 2024 00:55:45 +0200
In general a container can do if constexpr (std::is_same_v<T, int>) ... Is this true, if the underlying type is int and T is a subtype?   Or a container could even change member variable types and sizes depending on the template parameter.   What should a compiler automatically do then?   -----Ursprüngliche Nachricht----- Von:Karafiát, László via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Di 03.09.2024 00:40 Betreff:Re: [std-proposals] Fwd: Standardised Type Punning API for Wrapper Types An:Sebastian Wittmeier via Std-Proposals <std-proposals_at_[hidden]>; CC:Karafiát, László <laszlo_at_[hidden]>; I thought the vector would be type of sub-type, but the elements are 'automatically' super-type on demand i.e. when the compiler detects a chance for this (built-in) cast. e.g. the compiler cwould automatically generate some (internal) templates for the super- and sub-types as needed. There are not many cases - the number of built-in scalar types (here the super-types) are limited. *cwould: sorry Mr. Shakespaeare - it is rather late here now.. ( CET :)

Received on 2024-09-02 22:55:47