Skip to content

Commit 7a25b43

Browse files
guitargeekdpiparo
authored andcommitted
[core] Add TColorNumber constructor from a C-style string
We also require an overload for C-style strings. That's because the TColorNumber is designed to be constructed implicitly, and C++ won't do two user-defined conversions in a single implicit conversion chain.
1 parent 775ebc8 commit 7a25b43

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/base/inc/TColor.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ class TColorNumber {
143143
public:
144144
TColorNumber(Int_t color) : fNumber{color} {}
145145
TColorNumber(std::string const &color);
146+
// We also require an overload for C-style strings. That's because the
147+
// TColorNumber is designed to be constructed implicitly, and C++ won't do
148+
// two user-defined conversions in a single implicit conversion chain.
149+
inline TColorNumber(const char *color) : TColorNumber{std::string{color}} {}
146150
TColorNumber(std::array<Float_t, 3> rgb);
147151
Int_t number() const { return fNumber; }
148152

0 commit comments

Comments
 (0)