comparison enigma/machine.cpp @ 14:919b7a0d1802

Ditched shared_ptr.
author Brian Neal <bgneal@gmail.com>
date Mon, 02 Jul 2012 19:23:49 -0500
parents b9d124a15926
children
comparison
equal deleted inserted replaced
13:b9d124a15926 14:919b7a0d1802
14 14
15 //////////////////////////////////////////////////////////////////////////////// 15 ////////////////////////////////////////////////////////////////////////////////
16 16
17 enigma_machine::enigma_machine( 17 enigma_machine::enigma_machine(
18 const rotor_vector& rv, 18 const rotor_vector& rv,
19 std::shared_ptr<rotor> reflector, 19 const rotor& reflector,
20 const plugboard& pb) 20 const plugboard& pb)
21 : rotors(), 21 : rotors(),
22 pb(pb) 22 pb(pb)
23 { 23 {
24 rotors.push_back(*reflector); 24 rotors.push_back(reflector);
25 for (const auto& r : rv) 25 for (const auto& r : rv)
26 { 26 {
27 rotors.push_back(*r); 27 rotors.push_back(*r);
28 } 28 }
29 rotor_count_check(); 29 rotor_count_check();
31 31
32 //////////////////////////////////////////////////////////////////////////////// 32 ////////////////////////////////////////////////////////////////////////////////
33 33
34 enigma_machine::enigma_machine( 34 enigma_machine::enigma_machine(
35 const rotor_vector& rv, 35 const rotor_vector& rv,
36 std::shared_ptr<rotor> reflector) 36 const rotor& reflector)
37 : rotors(), 37 : rotors(),
38 pb() 38 pb()
39 { 39 {
40 rotors.push_back(*reflector); 40 rotors.push_back(reflector);
41 for (const auto& r : rv) 41 for (const auto& r : rv)
42 { 42 {
43 rotors.push_back(*r); 43 rotors.push_back(*r);
44 } 44 }
45 rotor_count_check(); 45 rotor_count_check();