diff options
author | Vincent Richard <[email protected]> | 2018-08-18 14:08:25 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2018-08-18 14:08:25 +0000 |
commit | f173b0a535e4d97c3ecd913eafb5e5c40aca2d44 (patch) | |
tree | c2c355b2e7fa5df7d5ea1c43154f274ee075c4ad /examples | |
parent | Fixed delete array. (diff) | |
download | vmime-f173b0a535e4d97c3ecd913eafb5e5c40aca2d44.tar.gz vmime-f173b0a535e4d97c3ecd913eafb5e5c40aca2d44.zip |
Avoid copy by passing shared_ptr<> with const reference.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/example6_authenticator.hpp | 4 | ||||
-rw-r--r-- | examples/example6_certificateVerifier.hpp | 2 | ||||
-rw-r--r-- | examples/example6_tracer.hpp | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/examples/example6_authenticator.hpp b/examples/example6_authenticator.hpp index b46f8ebd..64336e2a 100644 --- a/examples/example6_authenticator.hpp +++ b/examples/example6_authenticator.hpp @@ -7,7 +7,7 @@ class interactiveAuthenticator : public vmime::security::sasl::defaultSASLAuthen { const std::vector <vmime::shared_ptr <vmime::security::sasl::SASLMechanism> > getAcceptableMechanisms (const std::vector <vmime::shared_ptr <vmime::security::sasl::SASLMechanism> >& available, - vmime::shared_ptr <vmime::security::sasl::SASLMechanism> suggested) const + const vmime::shared_ptr <vmime::security::sasl::SASLMechanism>& suggested) const { std::cout << std::endl << "Available SASL mechanisms:" << std::endl; @@ -24,7 +24,7 @@ class interactiveAuthenticator : public vmime::security::sasl::defaultSASLAuthen return defaultSASLAuthenticator::getAcceptableMechanisms(available, suggested); } - void setSASLMechanism(vmime::shared_ptr <vmime::security::sasl::SASLMechanism> mech) + void setSASLMechanism(const vmime::shared_ptr <vmime::security::sasl::SASLMechanism>& mech) { std::cout << "Trying '" << mech->getName() << "' authentication mechanism" << std::endl; diff --git a/examples/example6_certificateVerifier.hpp b/examples/example6_certificateVerifier.hpp index e98f7874..b4b47a2a 100644 --- a/examples/example6_certificateVerifier.hpp +++ b/examples/example6_certificateVerifier.hpp @@ -7,7 +7,7 @@ class interactiveCertificateVerifier : public vmime::security::cert::defaultCert { public: - void verify(vmime::shared_ptr <vmime::security::cert::certificateChain> chain, const vmime::string& hostname) + void verify(const vmime::shared_ptr <vmime::security::cert::certificateChain>& chain, const vmime::string& hostname) { try { diff --git a/examples/example6_tracer.hpp b/examples/example6_tracer.hpp index 19d0f040..8f57f56c 100644 --- a/examples/example6_tracer.hpp +++ b/examples/example6_tracer.hpp @@ -6,8 +6,8 @@ class myTracer : public vmime::net::tracer { public: - myTracer(vmime::shared_ptr <std::ostringstream> stream, - vmime::shared_ptr <vmime::net::service> serv, const int connectionId) + myTracer(const vmime::shared_ptr <std::ostringstream>& stream, + const vmime::shared_ptr <vmime::net::service>& serv, const int connectionId) : m_stream(stream), m_service(serv), m_connectionId(connectionId) { } @@ -35,13 +35,13 @@ class myTracerFactory : public vmime::net::tracerFactory { public: - myTracerFactory(vmime::shared_ptr <std::ostringstream> stream) + myTracerFactory(const vmime::shared_ptr <std::ostringstream>& stream) : m_stream(stream) { } vmime::shared_ptr <vmime::net::tracer> create - (vmime::shared_ptr <vmime::net::service> serv, const int connectionId) + (const vmime::shared_ptr <vmime::net::service>& serv, const int connectionId) { return vmime::make_shared <myTracer>(m_stream, serv, connectionId); } |