mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-28 09:29:07 +00:00
Extended both classes to allow copy assignment, copy construction and implicit zero-length construction.
This commit is contained in:
parent
6369138bd1
commit
8a0b0cb3d7
@ -13,8 +13,15 @@
|
|||||||
class Cycles {
|
class Cycles {
|
||||||
public:
|
public:
|
||||||
Cycles(int l) : length_(l) {}
|
Cycles(int l) : length_(l) {}
|
||||||
|
Cycles(const Cycles &cycles) : length_(int(cycles)) {}
|
||||||
|
Cycles() : length_(0) {}
|
||||||
operator int() const { return length_; }
|
operator int() const { return length_; }
|
||||||
|
|
||||||
|
Cycles &operator =(const Cycles &cycles) {
|
||||||
|
length_ = cycles.length_;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int length_;
|
int length_;
|
||||||
};
|
};
|
||||||
@ -24,6 +31,14 @@ class HalfCycles {
|
|||||||
public:
|
public:
|
||||||
HalfCycles(int l) : length_(l) {}
|
HalfCycles(int l) : length_(l) {}
|
||||||
HalfCycles(const Cycles &cycles) : length_(int(cycles) << 1) {}
|
HalfCycles(const Cycles &cycles) : length_(int(cycles) << 1) {}
|
||||||
|
HalfCycles(const HalfCycles &half_cycles) : length_(int(half_cycles)) {}
|
||||||
|
HalfCycles() : length_(0) {}
|
||||||
|
|
||||||
|
HalfCycles &operator =(const HalfCycles &half_cycles) {
|
||||||
|
length_ = half_cycles.length_;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
operator int() const { return length_; }
|
operator int() const { return length_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user