/explore

Click through on any links that interest you or select the planets on the right to continue exploring the Outer Web.
You are here

zig.godbolt.org
| | gcc.godbolt.org
0.2 parsecs away

Travel
| | template<class T1, class T2> struct MyPair { T1 first; T2 second; static constexpr bool has_references = std::is_reference_v<T1> || std::is_reference_v<T2>; MyPair(const T1& x, const T2& y) : first(x), second(y) {} MyPair& operator=(const MyPair&) requires(!has_references) = default; MyPair& operator=(const MyPair& other) requires(has_references) { first = other.first; second = other.second; return *this; } }; int main() { int x = 10; MyPair<int&, int> a(x, 5); MyPair<int&, int> b(x, 10); b = a; }
| | gcc.godbolt.org
0.1 parsecs away

Travel
| | template<class T1, class T2> struct MyPair { T1 first; T2 second; static constexpr bool has_references = std::is_reference_v<T1> || std::is_reference_v<T2>; MyPair(const MyPair& other) = default; MyPair(const T1& x, const T2& y) : first(x), second(y) {} MyPair& operator=(const MyPair&) requires(!has_references) = default; MyPair& operator=(const MyPair& other) requires(has_references) { this->~MyPair(); return * new (this) MyPair(other); } }; int main() { int x = 10; int y = 1; MyPair<int&, int> a(x, 5); MyPair<int&, int> b(y, 10); b = a; return b.first; // 10 }
| | gcc.godbolt.org
0.1 parsecs away

Travel
| | struct MyPair { int a; int b; }; void CopyPair(const std::vector<std::pair<int, int>>& a, std::vector<std::pair<int, int>>& b) { std::copy(a.begin(), a.end(), b.begin()); } void SmartCopyPair(const std::vector<MyPair>& a, std::vector<MyPair>& b) { std::copy(a.begin(), a.end(), b.begin()); }
| | www.caichinger.com
15.7 parsecs away

Travel
| Introduction ELF is the file format used for object files (.o's), binaries, shared libraries and core dumps in Linux. It's actually pretty simple and well thought-out. ELF has the same layout for all architectures, however endianness and word size can differ; relocation types, symbol types and the like may have platform-specific values, and of course the contained code is arch specific. An ELF file provides 2 views on the data it contains: A linking view and an execution view. Those two views can be accessed by two headers: the section header table and the program header table. Linking view: Section Header Table (SHT) The SHT gives an overview on the sections contained in the ELF file. Of particular interest are REL sections (relocations), SYMTAB/DYNSYM (sym...