diff options
author | Karl Berry <karl@freefriends.org> | 2014-04-20 22:56:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-04-20 22:56:10 +0000 |
commit | ce5dd4137c8f88f9449e78ea4e02081bb589432e (patch) | |
tree | 1482a78c9484fb143211d3c1bb56d6c95f8393a1 /Build/source/utils/asymptote/guide.h | |
parent | d7e9f3fbc05b16e08afeb5b2569cb39a9b03e661 (diff) |
asy 2.25 sources
git-svn-id: svn://tug.org/texlive/trunk@33565 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/guide.h')
-rw-r--r-- | Build/source/utils/asymptote/guide.h | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/Build/source/utils/asymptote/guide.h b/Build/source/utils/asymptote/guide.h index 103e05afa41..a25e7ffa9e7 100644 --- a/Build/source/utils/asymptote/guide.h +++ b/Build/source/utils/asymptote/guide.h @@ -224,22 +224,33 @@ public: // tensions in between. typedef mem::vector<guide *> guidevector; +// A multiguide represents a guide given by the first "length" items of +// the vector pointed to by "base". +// The constructor, if given another multiguide as a first argument, +// will try to avoid allocating a new "base" array. class multiguide : public guide { - guidevector v; + guidevector *base; + size_t length; + + guide *subguide(size_t i) const + { + assert(i < length); + assert(length <= base->size()); + return (*base)[i]; + } public: + multiguide(guidevector& v); + void flatten(flatguide&, bool=true); bool cyclic() { - size_t n=v.size(); + size_t n=length; if(n < 1) return false; - return v[n-1]->cyclic(); + return subguide(n-1)->cyclic(); } - multiguide(guidevector& v) - : v(v) {} - path solve() { if (settings::verbose>3) { cerr << "solving guide:\n"; @@ -259,7 +270,8 @@ public: void print(ostream& out) const; side printLocation() const { - return v.back()->printLocation(); + int n = length; + return subguide(n-1)->printLocation(); } }; |