Skip to content

Commit 3267fcb

Browse files
rdemellowdaverigby
authored andcommitted
MB-30044: Make NetworkOrder classes use explicit single arg constructors
Make the single arg constructors of CollectionIDNetworkOrder and ScopeIDNetworkOrder use explicit constructors. Change-Id: I38c1199fd20ec9b5a9f1f1d69c1331b14cea8348 Reviewed-on: http://review.couchbase.org/c/kv_engine/+/133882 Tested-by: Build Bot <[email protected]> Reviewed-by: Dave Rigby <[email protected]>
1 parent a03bf02 commit 3267fcb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

include/memcached/dockey.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ using ScopeCollectionPair = std::pair<ScopeID, CollectionID>;
171171
*/
172172
class CollectionIDNetworkOrder {
173173
public:
174-
CollectionIDNetworkOrder(CollectionID v) : value(htonl(uint32_t(v))) {
174+
explicit CollectionIDNetworkOrder(CollectionID v)
175+
: value(htonl(uint32_t(v))) {
175176
}
176177

177178
CollectionID to_host() const {
@@ -184,7 +185,7 @@ class CollectionIDNetworkOrder {
184185

185186
class ScopeIDNetworkOrder {
186187
public:
187-
ScopeIDNetworkOrder(ScopeID v) : value(htonl(uint32_t(v))) {
188+
explicit ScopeIDNetworkOrder(ScopeID v) : value(htonl(uint32_t(v))) {
188189
}
189190

190191
ScopeID to_host() const {
@@ -201,11 +202,11 @@ static_assert(sizeof(CollectionIDType) == 4,
201202
static_assert(sizeof(ScopeIDType) == 4, "ScopeIDType assumes 4-byte id");
202203

203204
inline CollectionIDNetworkOrder CollectionID::to_network() const {
204-
return {*this};
205+
return CollectionIDNetworkOrder{*this};
205206
}
206207

207208
inline ScopeIDNetworkOrder ScopeID::to_network() const {
208-
return {*this};
209+
return ScopeIDNetworkOrder{*this};
209210
}
210211

211212
namespace std {

0 commit comments

Comments
 (0)