Improve and simplify code with modern C++ features
Change-Id: I28d84df3087492ab2ecbeb91169a2cde12c9e31e
diff --git a/src/security/tpm/back-end-file.cpp b/src/security/tpm/back-end-file.cpp
index 7c836d2..a560fad 100644
--- a/src/security/tpm/back-end-file.cpp
+++ b/src/security/tpm/back-end-file.cpp
@@ -129,7 +129,7 @@
return keyHandle;
}
catch (const std::runtime_error& e) {
- BOOST_THROW_EXCEPTION(Error(std::string("Cannot write key to disk: ") + e.what()));
+ BOOST_THROW_EXCEPTION(Error("Cannot write key to disk: "s + e.what()));
}
}
diff --git a/src/security/tpm/back-end-mem.cpp b/src/security/tpm/back-end-mem.cpp
index 9d051c6..2427229 100644
--- a/src/security/tpm/back-end-mem.cpp
+++ b/src/security/tpm/back-end-mem.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2013-2017 Regents of the University of California.
+/*
+ * Copyright (c) 2013-2018 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -23,6 +23,7 @@
#include "key-handle-mem.hpp"
#include "../transform/private-key.hpp"
#include "../../encoding/buffer-stream.hpp"
+
#include <unordered_map>
namespace ndn {
@@ -101,7 +102,7 @@
m_impl->keys[keyName] = key;
}
catch (const PrivateKey::Error& e) {
- BOOST_THROW_EXCEPTION(Error(std::string("Cannot import private key: ") + e.what()));
+ BOOST_THROW_EXCEPTION(Error("Cannot import private key: "s + e.what()));
}
}