Hack to get arround the retarded name-based hiding in derrived class overrides fucking up name base name lookups.

Fuck sepples, seriously

Fortune for cpprng's current commit: Blessing − 吉
capi
Avril 3 years ago
parent 9b2b2468cc
commit 2281a57bc9
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -11,6 +11,9 @@
#define CTOR_COPY(name) name(const name& copy)
#define CTOR_MOVE(name) name(name&& move)
// ugly hack to get around the absolutely retarded name lookup restrictions when overriding
#define RNG_OVERRIDE(ty, nm, rest) using Random::nm; ty nm rest override
namespace _rng__util {
struct divp
{

@ -17,14 +17,14 @@ namespace rng
crand(u64 seed);
inline ~crand() override{}
RNG_OVERRIDE(inline i64, next_i64, ()) { return _sample_int(); }
RNG_OVERRIDE(u64, next_u64,());
inline i64 next_i64() override { return _sample_int(); }
u64 next_u64() override;
RNG_OVERRIDE(i32, next_i32,());
RNG_OVERRIDE(u32, next_u32,());
i32 next_i32() override;
u32 next_u32() override;
void next_bytes(u8* p, usize n) override;
RNG_OVERRIDE(void, next_bytes, (u8* p, usize n));
protected:
inline constexpr i64 _max_i64() const override { return RANGE_MAX; }
inline constexpr u64 _max_u64() const override { return (u64)RANGE_MAX; }

@ -17,8 +17,7 @@ void r(Random& r)
void rng_test()
{
crand _r(123);
Random& r = _r;
crand r(123);
printf("%lu %lu %lu\n", r.next_u64(), r.next_u64(), r.next_u64());
printf("%d %d %d\n", r.next_i32(), r.next_i32(), r.next_i32());
printf("%u %u %u\n", r.next_u32(), r.next_u32(), r.next_u32());

Loading…
Cancel
Save