Some solutions to declare a const ref parameter that does not bind to a temporary.
Compiler-explorer link https://gcc.godbolt.org/z/8Gohnc98f
Some solutions to declare a const ref parameter that does not bind to a temporary.
Compiler-explorer link https://gcc.godbolt.org/z/8Gohnc98f
|-TypedefDecl 0x154f310 <<invalid sloc>> <invalid sloc> implicit __int128_t '__int128' | |
| `-BuiltinType 0x154efb0 '__int128' | |
|-TypedefDecl 0x154f380 <<invalid sloc>> <invalid sloc> implicit __uint128_t 'unsigned __int128' | |
| `-BuiltinType 0x154efd0 'unsigned __int128' | |
|-TypedefDecl 0x154f6f8 <<invalid sloc>> <invalid sloc> implicit __NSConstantString '__NSConstantString_tag' | |
| `-RecordType 0x154f470 '__NSConstantString_tag' | |
| `-CXXRecord 0x154f3d8 '__NSConstantString_tag' | |
|-TypedefDecl 0x154f790 <<invalid sloc>> <invalid sloc> implicit __builtin_ms_va_list 'char *' | |
| `-PointerType 0x154f750 'char *' | |
| `-BuiltinType 0x154eab0 'char' |
all: hello | |
gcm.cache: | |
g++ -std=c++20 -fmodules-ts -xc++-system-header iostream | |
helloworld.o: helloworld.cxx gcm.cache | |
g++ -std=c++20 -fmodules-ts -c helloworld.cxx -o helloworld.o | |
hello: helloworld.o | |
g++ -std=c++20 -fmodules-ts main.cpp helloworld.o -o hello |
--- | |
Language: Cpp | |
# BasedOnStyle: LLVM | |
AccessModifierOffset: -2 | |
AlignAfterOpenBracket: Align | |
AlignConsecutiveAssignments: false | |
AlignConsecutiveDeclarations: false | |
AlignEscapedNewlinesLeft: false | |
AlignOperands: true | |
AlignTrailingComments: true |
#include <type_traits> | |
#include <tuple> | |
template <typename T> struct is_pair : public std::false_type {}; | |
template <typename T1, typename T2> | |
struct is_pair<std::pair<T1, T2>> : public std::true_type {}; | |
template <typename T> constexpr auto is_pair_v = is_pair<T>::value; | |
template <typename T, typename = std::void_t<>> |
// trim from start (in place) | |
void ltrim(std::string &s) { | |
s.erase(s.begin(), std::find_if(s.begin(), s.end(), | |
[](int ch) { return !std::isspace(ch); })); | |
} | |
// trim from end (in place) | |
void rtrim(std::string &s) { | |
s.erase(std::find_if(s.rbegin(), s.rend(), | |
[](int ch) { return !std::isspace(ch); }) |
#include <functional> | |
#include <memory> | |
#include <optional> | |
#include <type_traits> | |
#include <utility> | |
namespace lazy { | |
template <typename T> class DelayProxy { | |
std::unique_ptr<T> subject{}; |
#include <string_view> | |
#include <cstdlib> | |
#include <ctime> | |
#include <tuple> | |
auto str_date = "02/03/88 00:54:56+04"; | |
using namespace std; | |
auto parse_time(string_view str_date) -> pair<tm, int>{ | |
auto next_token = [=, token_pos=0](auto delimiter, bool consume_delimiter = true) mutable{ | |
token_pos = str_date.find(delimiter, token_pos) + consume_delimiter? 1: 0; |
# chi sono | |
[contatti] | |
ciao sono andrea, lavoro qui a 2hire come sviluppatore embedded e smontacose. | |
Visto che chi non sa fare insegna, oggi voglio parlarvi di entity component system e perché penso sia veramente bello | |
e perché non l'ho mai usato | |
# survey | |
vedo un po' di facce conosciute. | |
quanti di voi sono programmatori puri? | |
quanti sono programmatori per necessità di videogioco? |