I wondered if it is valid to use std::function with incomplete type, e.g. in case of forward declaration. I wrote this small code: Even though the ...
I wondered if it is valid to use std::function with incomplete type, e.g. in case of forward declaration. I wrote this small code: Even though the ...
Reading https://en.cppreference.com/w/cpp/language/bit_field, are the following conclusions correct? whether adjacent bit-fields have no padding i ...
From the latest C2x (6.9p5) (emphasis added): An external definition is an external declaration that is also a definition of a function (other tha ...
In the following code, the can_foo concept tests whether or not a foo() member function can be called on an instance of a type. I will use it to test ...
The following code compiled well in trunk gcc and clang, but failed in msvc for c++20 mode: with the messages: Works well for msvc for c++1 ...
The C++20 standard states in [vector.overview]/4: An incomplete type T may be used when instantiating vector if the allocator meets the allocator ...
I'm making my own C compiler to try to learn as much details as possible about C. I'm now trying to understand exactly how volatile objects work. Wha ...
Consider some type T (for simplicity, you may assume int) and some integral constant N, which we use to define an array like this: According to cpp ...
In this code, why is the constness of GetAutoRef and GetAutoRefJ's return values different, the return value of GetDecltypeAutoJ not const? ...
I am learning overloading in Python 3.X and to better understand the topic, I wrote the following code that works in 3.X but not in 2.X. I expected th ...
Generally speaking, unless explicitly allowed, the behavior of a C++ program that tries to take the pointer of a standard library function is unspecif ...
In C++20 we can use lambda expressions in unevaluated contexts. Consider the following C++20 code: foo.cpp #include <typeinfo> struct Foo { ...
Unlike fundamental types – float, double and long double – are the new floatN_t types in <stdfloat> introduced in C++23 going to be always IEEE ...
I need to know if intmax_t is always "the same type" as uintmax_t except using two's complement instead of unsigned value. Or putting this in formal ...
In any case, A::Stuff is protected, so why inheriting from A and forcing its members' accessibility to protected resulting in an error ? class A { ...
Suppose I am writing a fixed-size array class of runtime size, somewhat equivalent to Rust's Box<[T]> in order to save the space of tracking cap ...
I have this piece of code: int foo() { return 0; } int main() { int (*float_function)(float) = foo; } When compiled using x86-64 GCC 12.2, with ...
I'm using a Raspberry Pi Pico, which has two cores, both with a 4KB stack, with core0's on top of core1's so that core0 gets to have 8KB of stack in s ...
Consider the following code: So GetTemp() returns a temporary object, which then gets assigned to a constant reference variable. However, that cons ...
Here is a struct with a templated constructor that is defined out of line: template <typename T> struct Foo { template <typename F> F ...