Changeset 3fb7f5e for doc/generic_types/evaluation/object.hpp
- Timestamp:
- Apr 14, 2017, 4:51:13 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 1504536, e3de500
- Parents:
- 3895b8b5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/generic_types/evaluation/object.hpp
r3895b8b5 r3fb7f5e 96 96 } 97 97 98 object& operator= (const object& that) override { return *this = that.as<boolean>(); } 98 object& operator= (const object& that) override { return *this = that.as<boolean>(); } /***/ 99 99 100 100 ~boolean() override = default; … … 102 102 int cmp(const boolean& that) const { return x == that.x ? 0 : x == false ? -1 : 1; } 103 103 104 int cmp(const ordered& that) const override { return cmp( that.as<boolean>() ); } 104 int cmp(const ordered& that) const override { return cmp( that.as<boolean>() ); } /***/ 105 105 106 106 void print(std::ostream& out) const override { out << (x ? "true" : "false"); } … … 124 124 } 125 125 126 object& operator= (const object& that) override { return *this = that.as<character>(); } 126 object& operator= (const object& that) override { return *this = that.as<character>(); } /***/ 127 127 128 128 ~character() override = default; … … 130 130 int cmp(const character& that) const { return x == that.x ? 0 : x < that.x ? -1 : 1; } 131 131 132 int cmp(const ordered& that) const override { return cmp( that.as<character>() ); } 132 int cmp(const ordered& that) const override { return cmp( that.as<character>() ); } /***/ 133 133 134 134 void print(std::ostream& out) const override { … … 155 155 } 156 156 157 object& operator= (const object& that) override { return *this = that.as<integer>(); } 157 object& operator= (const object& that) override { return *this = that.as<integer>(); } /***/ 158 158 159 159 ~integer() override = default; … … 161 161 int cmp(const integer& that) const { return x == that.x ? 0 : x < that.x ? -1 : 1; } 162 162 163 int cmp(const ordered& that) const override { return cmp( that.as<integer>() ); } 163 int cmp(const ordered& that) const override { return cmp( that.as<integer>() ); } /***/ 164 164 165 165 void print(std::ostream& out) const override { out << x; } … … 183 183 } 184 184 185 object& operator= (const object& that) override { return *this = that.as<c_string>(); } 185 object& operator= (const object& that) override { return *this = that.as<c_string>(); } /***/ 186 186 187 187 ~c_string() override = default; … … 212 212 } 213 213 214 object& operator= (const object& that) override { return *this = that.as<pair>(); } 214 object& operator= (const object& that) override { return *this = that.as<pair>(); } /***/ 215 215 216 216 ~pair() override = default; 217 217 218 218 int cmp(const pair& that) const { 219 int c = x->as<ordered>().cmp( that.x->as<ordered>() ); 219 int c = x->as<ordered>().cmp( that.x->as<ordered>() ); /***/ 220 220 if ( c != 0 ) return c; 221 return y->as<ordered>().cmp( that.y->as<ordered>() ); 221 return y->as<ordered>().cmp( that.y->as<ordered>() ); /***/ 222 222 } 223 223 … … 226 226 void print(std::ostream& out) const override { 227 227 out << "["; 228 x->as<printable>().print(out); 228 x->as<printable>().print(out); /***/ 229 229 out << ", "; 230 y->as<printable>().print(out); 230 y->as<printable>().print(out); /***/ 231 231 out << "]"; 232 232 }
Note: See TracChangeset
for help on using the changeset viewer.