change 'constructor with 1 argument' to explicit constructor 99/210199/1 accepted/tizen/unified/20190724.063739 submit/tizen/20190722.121816
authorsanghyeok.oh <sanghyeok.oh@samsung.com>
Wed, 17 Jul 2019 00:19:21 +0000 (09:19 +0900)
committersanghyeok.oh <sanghyeok.oh@samsung.com>
Wed, 17 Jul 2019 00:23:19 +0000 (09:23 +0900)
* implicit conversion
The compiler is allowed to make one implicit conversion to resolve the parameters to a function.
What this means is that the compiler can use constructors callable with a single parameter to convert from one type to another in order to get the right type for a parameter.

Change-Id: I79da863d9d86d3ea19e43089f2c836d2f52ef6d8
Signed-off-by: sanghyeok.oh <sanghyeok.oh@samsung.com>
src/internal/transaction_guard.hpp
src/internal/tslog.hpp
src/kdbus.h

index 8357459..dec307f 100644 (file)
@@ -27,7 +27,7 @@ class Guard {
        FunRelease fun;
        bool active;
 public:
-       Guard(FunRelease f) : fun(f), active(true) {}
+       explicit Guard(FunRelease f) : fun(f), active(true) {}
        Guard() = delete;
        Guard(const Guard &) = delete;
        Guard &operator=(const Guard &) = delete;
index e5ad89f..f028601 100644 (file)
@@ -74,7 +74,7 @@ namespace tslog
 
        struct print_errno {
                int err;
-               print_errno(int e) : err(e) {}
+               explicit print_errno(int e) : err(e) {}
        };
 
        std::ostream &operator<<(std::ostream &stream, const print_errno &p);
@@ -85,7 +85,7 @@ namespace tslog
        class LogLock {
                bool locked;
        public:
-               LogLock(ldp_log_level level = ldp_log_level::ERROR);
+               explicit LogLock(ldp_log_level level = ldp_log_level::ERROR);
                ~LogLock();
        };
 }
index bf17d5f..22b7ec5 100644 (file)
@@ -62,7 +62,7 @@ class KdbusConnectionInfo {
        KdbusConnection &my_connection;
 
 public:
-       KdbusConnectionInfo(KdbusConnection &c) : my_connection{c} {}
+       explicit KdbusConnectionInfo(KdbusConnection &c) : my_connection{c} {}
        ~KdbusConnectionInfo() { release_info(); }
 
        void release_info();