google-explicit-constructor

This commit is contained in:
Daniel Chabrowski
2018-02-25 01:40:46 +01:00
parent 1e1ca23101
commit ad624432d8
7 changed files with 18 additions and 18 deletions

View File

@@ -67,7 +67,7 @@ async_msg(async_msg&& other) SPDLOG_NOEXCEPT:
msg_id(other.msg_id)
{}
async_msg(async_msg_type m_type):
explicit async_msg(async_msg_type m_type):
level(level::info),
thread_id(0),
msg_type(m_type),
@@ -91,7 +91,7 @@ async_msg(async_msg&& other) SPDLOG_NOEXCEPT:
async_msg& operator=(const async_msg& other) = delete;
// construct from log_msg
async_msg(const details::log_msg& m):
explicit async_msg(const details::log_msg& m):
level(m.level),
time(m.time),
thread_id(m.thread_id),

View File

@@ -53,13 +53,13 @@ namespace spdlog
namespace details
{
template<typename T>
template <typename T>
class mpmc_bounded_queue
{
public:
using item_type = T;
mpmc_bounded_queue(size_t buffer_size)
explicit mpmc_bounded_queue(size_t buffer_size)
:max_size_(buffer_size),
buffer_(new cell_t[buffer_size]),
buffer_mask_(buffer_size - 1)
@@ -79,6 +79,8 @@ public:
delete[] buffer_;
}
mpmc_bounded_queue(mpmc_bounded_queue const&) = delete;
void operator=(mpmc_bounded_queue const&) = delete;
bool enqueue(T&& data)
{
@@ -167,9 +169,6 @@ private:
cacheline_pad_t pad2_;
std::atomic<size_t> dequeue_pos_;
cacheline_pad_t pad3_;
mpmc_bounded_queue(mpmc_bounded_queue const&) = delete;
void operator= (mpmc_bounded_queue const&) = delete;
};
} // ns details

View File

@@ -27,7 +27,7 @@ struct null_atomic_int
int value;
null_atomic_int() = default;
null_atomic_int(int val):value(val)
explicit null_atomic_int(int val) : value(val)
{}
int load(std::memory_order) const

View File

@@ -26,9 +26,12 @@ namespace spdlog
{
namespace details
{
template <class Mutex> class registry_t
template <class Mutex>
class registry_t
{
public:
registry_t<Mutex>(const registry_t<Mutex>&) = delete;
registry_t<Mutex>& operator=(const registry_t<Mutex>&) = delete;
void register_logger(std::shared_ptr<logger> logger)
{
@@ -38,7 +41,6 @@ public:
_loggers[logger_name] = logger;
}
std::shared_ptr<logger> get(const std::string& logger_name)
{
std::lock_guard<Mutex> lock(_mutex);
@@ -111,6 +113,7 @@ public:
std::lock_guard<Mutex> lock(_mutex);
_loggers.clear();
}
std::shared_ptr<logger> create(const std::string& logger_name, sinks_init_list sinks)
{
return create(logger_name, sinks.begin(), sinks.end());
@@ -195,8 +198,6 @@ public:
private:
registry_t<Mutex>() = default;
registry_t<Mutex>(const registry_t<Mutex>&) = delete;
registry_t<Mutex>& operator=(const registry_t<Mutex>&) = delete;
void throw_if_exists(const std::string &logger_name)
{