Skip to content

Commit

Permalink
Build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
snej committed Oct 12, 2023
1 parent e0432e1 commit 2b14e21
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion crouton.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if which missing_includes.rb >/dev/null\nthen\n cd \"$SRCROOT\"\n missing_includes.rb -w --base include/Base.hh include src\nelse\n echo \"Script missing_includes.rb not found.\"\n echo \"You can get it from https://gist.github.com/snej/2672fe996d39752e23c471f6ed789958\"\nfi\n";
shellScript = "if which missing_includes.rb >/dev/null\nthen\n cd \"$SRCROOT\"\n missing_includes.rb -w --base include/util/Base.hh include src\nelse\n echo \"Script missing_includes.rb not found.\"\n echo \"You can get it from https://gist.github.com/snej/2672fe996d39752e23c471f6ed789958\"\nfi\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down
25 changes: 12 additions & 13 deletions include/util/Relation.hh
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ namespace crouton::util {
class ToMany : private LinkedList<ToOne<Other,Self>>, private Child<Self> {
public:
using super = LinkedList<ToOne<Other,Self>>;
using ToOne = ToOne<Other,Self>;

/// Initializes an unconnected Child. This should be a member initializer of Self.
explicit ToMany(Self* self) :Child<Self>(self) { }
Expand All @@ -151,35 +150,35 @@ namespace crouton::util {

class iterator {
public:
explicit iterator(super::iterator i) :_i(i) { }
explicit iterator(typename super::iterator i) :_i(i) { }
Other& operator*() const {return *(_i->self());}
Other* operator->() const {return _i->self();}
iterator& operator++() {++_i; return *this;}
friend bool operator==(iterator const& a, iterator const& b) {return a._i == b._i;}
private:
super::iterator _i;
typename super::iterator _i;
};

iterator begin() {return iterator(super::begin());}
iterator end() {return iterator(super::end());}
iterator begin() {return iterator(super::begin());}
iterator end() {return iterator(super::end());}

void push_front(ToOne& link) {super::push_front(link); link._parent = this;}
void push_back(ToOne& link) {super::push_back(link); link._parent = this;}
void erase(ToOne& link) {super::erase(link); link._parent = nullptr;}
void push_front(ToOne<Other,Self>& link) {super::push_front(link); link._parent = this;}
void push_back(ToOne<Other,Self>& link) {super::push_back(link); link._parent = this;}
void erase(ToOne<Other,Self>& link) {super::erase(link); link._parent = nullptr;}

void clear() {deAdopt(); super::clear();}
void clear() {deAdopt(); super::clear();}

~ToMany() {deAdopt();}
~ToMany() {deAdopt();}

private:
friend ToOne;
friend ToOne<Other,Self>;

void adopt() {
for (ToOne& child : (super&)*this)
for (ToOne<Other,Self>& child : (super&)*this)
child._parent = this;
}
void deAdopt() {
for (ToOne& child : (super&)*this)
for (ToOne<Other,Self>& child : (super&)*this)
child._parent = nullptr;
}
};
Expand Down

0 comments on commit 2b14e21

Please sign in to comment.