mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-19 08:31:11 +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 {
|
||||
public:
|
||||
Cycles(int l) : length_(l) {}
|
||||
Cycles(const Cycles &cycles) : length_(int(cycles)) {}
|
||||
Cycles() : length_(0) {}
|
||||
operator int() const { return length_; }
|
||||
|
||||
Cycles &operator =(const Cycles &cycles) {
|
||||
length_ = cycles.length_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
int length_;
|
||||
};
|
||||
@ -24,6 +31,14 @@ class HalfCycles {
|
||||
public:
|
||||
HalfCycles(int l) : length_(l) {}
|
||||
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_; }
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user