This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "AAA.h" | |
#include "ClassA.h" | |
size_t AAA:get_sSize() { | |
// Initialized on first use. | |
static size_t sSize = ClassA::Insert( "AAA" ); | |
// return the value that is only initialized once. | |
return sSize; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> g++ -std=c++17 test.cpp | |
> ./a.out | |
Expect: Construct Normal | |
Construct Normal | |
Expect: Construct Copy | |
Constructor Copy | |
Expect: Construct Move |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "md5.h" | |
#include <iostream> | |
#include <cmath> | |
#include <bit> | |
const std::array<std::uint32_t, 64> pstl::cryptography::hashing::md5::s_array = { | |
7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, | |
5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, | |
4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ThorsAnvil | |
{ | |
class SomeThingWithResource | |
{ | |
public: | |
// Construction / Destruction | |
SomeThingWithResource() | |
: // Initalize Resouces | |
{} | |
~SomeThingWithResource() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Not sure I understand the statement. | |
The type `T` is used to somehow load the configuration in some way? | |
class UConfigurableBase | |
{ | |
public: | |
virtual json GetDefaultConfig() = 0; | |
bool Validate(const json& source ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct der | |
{ | |
private: // No resources :-( | |
int *p=new int[4]; // This is a resource. | |
// If you don't do anything it will leak. | |
public: | |
}; | |
struct derWithDestructorOnly: public base | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string> | |
#include <iostream> | |
int main() | |
{ | |
std::string s; | |
std::getline(std::cin, s); // Should check that worked. | |
int q; | |
std::cin >> q; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// See Simple Example https://github.com/Loki-Astari/ThorsSerializer/blob/master/doc/example1.md | |
#include <iostream> | |
#include <sstream> | |
#include <vector> | |
#include "ThorSerialize/Traits.h" | |
#include "ThorSerialize/JsonThor.h" | |
#include "ThorSerialize/SerUtil.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Version 1 | |
// Your version | |
// Two layers of indirection. | |
std::string** myArray = new string*[size]; // call to new must be matched with delete. | |
for (int loop; loop < size; ++loop) { | |
myArray[loop] = new string; // call to new must be matched with delete. | |
std::getline(std::cin, myArray[loop][0], '/'); | |
std::getline(std::cin, myArray[loop][1]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Note I removed the header | |
.globl __Z4fibLi ## -- Begin function _Z4fibLi | |
.p2align 4, 0x90 | |
__Z4fibLi: ## @_Z4fibLi | |
.cfi_startproc | |
## %bb.0: | |
pushq %rbp | |
.cfi_def_cfa_offset 16 | |
.cfi_offset %rbp, -16 | |
movq %rsp, %rbp |
NewerOlder