Regarding Is there no conversion from to because is explicit? Would it have been possible to have had a type conversion of type floating- ...
Regarding Is there no conversion from to because is explicit? Would it have been possible to have had a type conversion of type floating- ...
I used the code below to test the behaviour of copy assignment operator: I expected both p1 and p2 have the same value of stamina. But the output s ...
I'm unable to figure out why my conversion operator is considering the explicit constructor. If I call the operator directly like this: A<float& ...
I have this class SmallInt that should represent a positive integer value in the range 0-255-inclusive: What matters me is: why can I assign to ...
I am writing a fixed size container type, with placement new. When I was testing it I figured it out my "emplace_back()" like function does not compil ...
Is using the cast constructor bad? Otherweise why a code quality checker (cppcheck in my case) would constantly suggest to add explicit before single ...
Some (many?) programmers who are introduced to both std::string_view and std::string ask themselves: "Why can I convert the latter into the former, bu ...
cppreference shows the following definition of std::in_place_t: Why have they added an explicit and defaulted constructor? Why it isn't left out? W ...
On cppreference about list-initialization in the second intend (for copy-list-initialization) it says: copy-list-initialization (both explicit and ...
Minimal example program: It would intuitively make sense for this to be a valid program: the call using overload #1 would be valid, the call using ...
I am reviewing operator overloading in C++. Just for fun I am implementing a BigInt class. The first operator I want to overload for it is the additi ...
In the below code, the compiler can't figure out which constructor I want to use. Why, and how do I fix this? (Live example) ...
I'm writing a class that has an explicit constructor taking a const char* argument. For the intents and purposes of this question it looks like this: ...
I compiled the code below using g++ 6.3.0, with -std=c++14 option. I expected it to output "1!" since the conversion is implicit, but it output "2! ...
In C++17, empty tag types in the standard library now have default constructors which are marked explicit, and are also = default. For example, std::p ...
I wanted to create a class MPSList where constructor has an explicit keyword associated with it. Following is the bare minimal code: CPP file that ...
Intel C++ compiler (Version 16.0.3.207 Build 20160415) seems to drop the explicit specifier when the constructor of the base class is inherited with u ...
An external library we are using contains the following explicit constructor: The compiler complains with the following warning: Is it binary co ...
Does making a constructor having multiple arguments explicit have any (useful) effect? Example: ...
According to here, explicit: Specifies constructors and conversion operators (since C++11) that don't allow implicit conversions or copy-initializ ...