29
edits
(Added initializer list style.) |
|||
| Line 48: | Line 48: | ||
* No exceptions, so std is hard to use. There is initial work underway to make STL-like containers that mesh well with the rest of the JS engine (see js::Vector, js::HashMap, js::Pool). | * No exceptions, so std is hard to use. There is initial work underway to make STL-like containers that mesh well with the rest of the JS engine (see js::Vector, js::HashMap, js::Pool). | ||
** There are still improvements to be made to the new hash table: double-hash implementation; improve bit-mixing into multiplicative hash if the cycle costs can be supported (measurement is required and we should understand down to the bits what is going on); a js::HashSet or js::HashMap<T,void> specialization such that set-like use of hashtables do not waste any space on values. | ** There are still improvements to be made to the new hash table: double-hash implementation; improve bit-mixing into multiplicative hash if the cycle costs can be supported (measurement is required and we should understand down to the bits what is going on); a js::HashSet or js::HashMap<T,void> specialization such that set-like use of hashtables do not waste any space on values. | ||
* Initializer lists can break in one of two ways. The first may be preferable when constructors take few arguments: | |||
class Ninja : public WeaponWeilder, public Camouflagible, | |||
public Assassinatable, public ShapeShiftable | |||
{ | |||
Ninja() : WeaponWeilder(Weapons.SHURIKEN), | |||
Camouflagible(Garments.SHINOBI_SHOZOKU), | |||
Assassinatable(AssassinationDifficulty.HIGHLY_DIFFICULT), | |||
ShapeShiftable(MPCost(512)) {} | |||
} | |||
The other permitted style mitigates longer-identifiers-squishing-text-against-the-right-side-of-the-screen-syndrome by using a half-indented colon: | |||
class Ninja | |||
: public WeaponWeilder, public Camouflagible, public Assassinatable, | |||
public ShapeShiftable | |||
{ | |||
Ninja() | |||
: WeaponWeilder(Weapons.SHURIKEN), | |||
Camouflagible(Garments.SHINOBI_SHOZOKU), | |||
Assassinatable(AssassinationDifficulty.HIGHLY_DIFFICULT), | |||
ShapeShiftable(MPCost(512)) {} | |||
} | |||
== Boolean Types == | == Boolean Types == | ||
edits