All that aligned_ptr<bullshit> work for nothing huh...

Fortune for cpprng's current commit: Half blessing − 半吉
lib
Avril 3 years ago
parent 3b1628d396
commit 2b24ab0408
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -0,0 +1,16 @@
#pragma once
#include "../rng.h"
#include "../mem.h"
namespace rng
{
struct crand final : public Random
{
private:
struct _inner;
// XXX: FUCK: This doesn't fucking work...
mem::aligned_ptr<jr_state> _state;
};
}

@ -17,10 +17,3 @@ namespace mem
void aligned_ptr<void >::_dealloc(void* ptr) { free(ptr); }
}
void test()
{
auto ptr = mem::make_aligned<std::string>("hello");
auto len = ptr->size();
printf("Stirng: %s, %lu\n", ptr->c_str(), (usize)len);
}

@ -1,4 +1,5 @@
#include <rng.h>
#include <rng/crand.h>
#include <cstdio>
@ -12,11 +13,8 @@ void r(Random& r)
std::array<char, 10> nn = r.next<std::array<char, 10>>();
}
void test();
int main()
{
test();
return 0;
}

@ -1,8 +1,15 @@
#include <rng.h>
#include <mem.h>
#include <rng/crand.h>
#include "crand.h"
namespace rng
{
struct crand::_inner {
jr_state st;
};
//TODO: Make header for rng::crand, a derived type of `Random`.
}

Loading…
Cancel
Save