Mercurial > public > cpp-enigma
diff enigma/machine.h @ 14:919b7a0d1802
Ditched shared_ptr.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 02 Jul 2012 19:23:49 -0500 |
parents | b9d124a15926 |
children | 9e02d8696e67 |
line wrap: on
line diff
--- a/enigma/machine.h Mon Jul 02 19:14:36 2012 -0500 +++ b/enigma/machine.h Mon Jul 02 19:23:49 2012 -0500 @@ -16,7 +16,7 @@ namespace enigma { - typedef std::vector<std::shared_ptr<rotor>> rotor_vector; + typedef std::vector<rotor*> rotor_vector; class enigma_machine_error : public enigma_error { @@ -29,14 +29,16 @@ class enigma_machine { public: - // construct an Enigma machine from component parts: + // Construct an Enigma machine from component parts. + // Note that the enigma_machine makes copies of the rotors and will not + // delete the rotor pointers: enigma_machine(const rotor_vector& rv, - std::shared_ptr<rotor> reflector, + const rotor& reflector, const plugboard& pb); // construct an Enigma machine with a default plugboard (no cables connected): enigma_machine(const rotor_vector& rv, - std::shared_ptr<rotor> reflector); + const rotor& reflector); // key-sheet style constructors: enigma_machine(const std::vector<std::string>& rotor_types,