forked from girving/mandelbrot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
arf_cc.h
31 lines (23 loc) · 706 Bytes
/
arf_cc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// C++ interface to arf_t
#pragma once
#include <arf.h>
#include <string>
namespace mandelbrot {
using std::string;
struct Arf {
arf_t x;
Arf() { arf_init(x); }
Arf(const Arf& a) = delete;
Arf(Arf&& a) { *x = *a.x; arf_init(a.x); }
~Arf() { arf_clear(x); }
// Assignment
Arf& operator=(const Arf& a) { arf_set(x, a.x); return *this; }
Arf& operator=(Arf&& a) { arf_swap(x, a.x); arf_zero(a.x); return *this; }
// Implicit converson
operator arf_ptr() { return x; }
operator arf_srcptr() const { return x; }
// Printing
string safe() const; // Integer mantissa and exponent
friend std::ostream& operator<<(std::ostream& out, const Arf& a);
};
} // namespace mandelbrot