mark constructors explicit

This commit is contained in:
Arne Morten Kvarving 2023-05-16 10:50:01 +02:00
parent cb394ed19c
commit 6553e8d0b7
28 changed files with 33 additions and 33 deletions

View File

@ -112,7 +112,7 @@ public:
Color3f();
Color3f(float r, float g, float b);
Color3f(const Color3f& other);
Color3f(ColorIdent colorIdent);
explicit Color3f(ColorIdent colorIdent);
explicit Color3f(const Color3ub& other);
Color3f& operator=(const Color3f& rhs);
@ -158,7 +158,7 @@ public:
Color3ub();
Color3ub(ubyte r, ubyte g, ubyte b);
Color3ub(const Color3ub& other);
Color3ub(ColorIdent colorIdent);
explicit Color3ub(ColorIdent colorIdent);
explicit Color3ub(const Color3f& other);
Color3ub& operator=(const Color3ub& rhs);

View File

@ -60,7 +60,7 @@ public:
};
public:
DebugTimer(const char* prefix, OperationMode operationMode = NORMAL);
explicit DebugTimer(const char* prefix, OperationMode operationMode = NORMAL);
~DebugTimer();
void restart(const char* msg = NULL);

View File

@ -52,7 +52,7 @@ class Flags
public:
inline Flags();
inline Flags(const Flags& other);
inline Flags(FlagEnum flag);
explicit inline Flags(FlagEnum flag);
inline Flags& operator=(const Flags& rhs);
inline Flags& operator=(FlagEnum flag);

View File

@ -99,7 +99,7 @@ class ref
public:
ref(T* object = NULL);
ref(const ref& other);
template<typename T2> ref(const ref<T2>& other);
template<typename T2> explicit ref(const ref<T2>& other);
~ref();
ref& operator=(T* rhs);
@ -150,7 +150,7 @@ class cref
public:
cref(const T* object = NULL);
cref(const cref& other);
template<typename T2> cref(const cref<T2>& other);
template<typename T2> explicit cref(const cref<T2>& other);
~cref();
cref& operator=(const T* rhs);

View File

@ -108,7 +108,7 @@ public:
using MemberCallbackAndActiveFlag = std::pair<MemberCallback, bool>;
public:
Signal( const SignalEmitter* emitter )
explicit Signal( const SignalEmitter* emitter )
: m_emitter( emitter )
{
m_emitter->addEmittedSignal( this );

View File

@ -34,7 +34,7 @@ namespace Opm {
typedef std::vector< DeckItem >::const_iterator const_iterator;
DeckRecord() = default;
DeckRecord( std::vector< DeckItem >&& items, const bool check_for_duplicate_names = true );
explicit DeckRecord( std::vector< DeckItem >&& items, const bool check_for_duplicate_names = true );
static DeckRecord serializationTestObject();

View File

@ -38,7 +38,7 @@ namespace Opm {
class DeckTree {
public:
DeckTree() = default;
DeckTree(const std::string&);
explicit DeckTree(const std::string&);
const std::string& parent(const std::string& fname) const;
bool includes(const std::string& parent_file, const std::string& include_file) const;

View File

@ -33,7 +33,7 @@ public:
struct Iterator : public storage_type::iterator {
Iterator(storage_type::const_iterator inner_iter) :
explicit Iterator(storage_type::const_iterator inner_iter) :
inner(inner_iter)
{}

View File

@ -124,7 +124,7 @@ namespace Opm {
AquiferCT() = default;
AquiferCT(const TableManager& tables, const Deck& deck);
AquiferCT(const std::vector<AquiferCT::AQUCT_data>& data);
explicit AquiferCT(const std::vector<AquiferCT::AQUCT_data>& data);
void loadFromRestart(const RestartIO::RstAquifer& rst,
const TableManager& tables);

View File

@ -75,7 +75,7 @@ namespace Opm {
/// EclipseGrid ignores ACTNUM in Deck, and therefore needs ACTNUM
/// explicitly. If a null pointer is passed, every cell is active.
EclipseGrid(const Deck& deck, const int * actnum = nullptr);
explicit EclipseGrid(const Deck& deck, const int * actnum = nullptr);
static bool hasGDFILE(const Deck& deck);
static bool hasCylindricalKeywords(const Deck& deck);

View File

@ -28,7 +28,7 @@ namespace Opm {
class PlymaxTable : public SimpleTable {
public:
PlymaxTable( const DeckRecord& record );
explicit PlymaxTable(const DeckRecord& record);
const TableColumn& getPolymerConcentrationColumn() const;
const TableColumn& getMaxPolymerConcentrationColumn() const;

View File

@ -23,13 +23,13 @@
namespace Opm {
class DeckReckord;
class DeckRecord;
class PlyrockTable : public SimpleTable {
public:
// This is not really a table; every column has only one element.
PlyrockTable( const DeckRecord& record );
explicit PlyrockTable(const DeckRecord& record);
// since this keyword is not necessarily monotonic, it cannot be evaluated!
//using SimpleTable::evaluate;

View File

@ -30,7 +30,7 @@ namespace Opm {
class KeywordGenerator {
public:
KeywordGenerator(bool verbose);
explicit KeywordGenerator(bool verbose);
static void ensurePath( const std::string& file_name);
static std::string endTest();

View File

@ -42,7 +42,7 @@ class State {
struct RunState {
RunState() = default;
RunState(std::time_t sim_time)
explicit RunState(std::time_t sim_time)
: run_count(1)
, last_run(sim_time)
{}

View File

@ -121,7 +121,7 @@ public:
};
CompletedCells() = default;
CompletedCells(const GridDims& dims);
explicit CompletedCells(const GridDims& dims);
CompletedCells(std::size_t nx, std::size_t ny, std::size_t nz);
const Cell& get(std::size_t i, std::size_t j, std::size_t k) const;
std::pair<bool, Cell&> try_get(std::size_t i, std::size_t j, std::size_t k);

View File

@ -31,7 +31,7 @@ class GasLiftGroup {
public:
GasLiftGroup() = default;
GasLiftGroup(const std::string& name) :
explicit GasLiftGroup(const std::string& name) :
m_name(name)
{}

View File

@ -111,7 +111,7 @@ public:
GuideRateModel::Target target { GuideRateModel::Target::NONE };
};
GuideRate(const Schedule& schedule);
explicit GuideRate(const Schedule& schedule);
void setSerializationTestData();

View File

@ -35,7 +35,7 @@ namespace Opm {
class AutoICD : public SICD {
public:
AutoICD() = default;
AutoICD(const DeckRecord& record);
explicit AutoICD(const DeckRecord& record);
static AutoICD serializationTestObject();

View File

@ -90,7 +90,7 @@ namespace Opm {
const double x_in,
const double y_in);
Segment(const RestartIO::RstSegment& rst_segment);
explicit Segment(const RestartIO::RstSegment& rst_segment);
static Segment serializationTestObject();

View File

@ -30,7 +30,7 @@ namespace Network {
class Node {
public:
Node() = default;
Node(const std::string& name);
explicit Node(const std::string& name);
const std::string& name() const;
const std::optional<double>& terminal_pressure() const;

View File

@ -38,7 +38,7 @@ class UDQState
{
public:
UDQState() = default;
UDQState(double undefined);
explicit UDQState(double undefined);
bool has(const std::string& key) const;
void load_rst(const RestartIO::RstState& rst_state);

View File

@ -28,7 +28,7 @@ namespace Opm {
struct WellInjectionControls {
public:
WellInjectionControls(int controls_arg) :
explicit WellInjectionControls(int controls_arg) :
controls(controls_arg)
{}

View File

@ -28,7 +28,7 @@ namespace Opm {
struct WellProductionControls {
public:
WellProductionControls(int controls_arg) :
explicit WellProductionControls(int controls_arg) :
controls(controls_arg)
{
}

View File

@ -27,8 +27,8 @@ namespace Opm {
class Dimension {
public:
Dimension();
Dimension(double SIfactor,
double SIoffset = 0.0);
explicit Dimension(double SIfactor,
double SIoffset = 0.0);
static Dimension serializationTestObject();

View File

@ -56,7 +56,7 @@ struct Vector{
public:
ERsm(const std::string& fname);
explicit ERsm(const std::string& fname);
const std::vector<TimeStampUTC>& dates() const;
const std::vector<double>& days() const;

View File

@ -39,8 +39,8 @@ struct RstAction {
Quantity() = default;
Quantity(const std::string * zacn, double sacn_value);
Quantity(const std::string& quantity);
Quantity(double value);
explicit Quantity(const std::string& quantity);
explicit Quantity(double value);
};

View File

@ -264,7 +264,7 @@ void AquiferCT::loadFromRestart(const RestartIO::RstAquifer& rst,
AquiferCT AquiferCT::serializationTestObject()
{
return { { AQUCT_data::serializationTestObject() } };
return AquiferCT{ { AQUCT_data::serializationTestObject() } };
}
std::size_t AquiferCT::size() const {

View File

@ -136,7 +136,7 @@ namespace {
parseContext.handleError(ParseContext::PARSE_EXTRA_DATA , msg_format, location, errors);
}
return { std::move( items ), false };
return DeckRecord{ std::move( items ), false };
}
bool ParserRecord::equal(const ParserRecord& other) const {