ifstream constructor taken a char* but not a std::string [duplicate] - c++

This question already has answers here:
Why does (i|o)fstream take a const char* parameter for a file name?
(5 answers)
Closed 8 years ago.
Is there any reasons - other than historical - to justify the fact std::ifstream/std::ofstream class take a char* and not a std::string to be constructed?

No. The constructor from std::string was added in C++11.

Related

Does C++ allows move semantics on int[]? [duplicate]

This question already has answers here:
what will happen when std::move with c style array or not movable object
(2 answers)
Can std::move move a built-in types or c pointer or array
(1 answer)
What is std::move(), and when should it be used?
(9 answers)
Closed 8 months ago.
I want to do something like this:
int data[4] = {1,2,3,4};
int otherData[4];
otherData = std::move(data);
compiler says invalid array assignment, so how can I transfer values from data to otherData

what is the difference between these two way to assign array in C++? [duplicate]

This question already has answers here:
difference between two array declaration methods c++
(4 answers)
What is the difference between Static and Dynamic arrays in C++?
(13 answers)
Closed 10 months ago.
int numList1[10];
int *numList2 = new int[10];
I have seen too many solutions from others used the second way to assign array, do they work as the same?

Is it possible to overload the "evaluation operator"? [duplicate]

This question already has answers here:
Which operator to overload in order to use my class in an if-statement? [duplicate]
(4 answers)
How do I override the bool operator in a C++ class?
(4 answers)
User Defined Conversions in C++
(4 answers)
Closed 4 years ago.
I am familiar with operator overloading, but a question popped up in my mind.
Is it possible to overload how an object behaves upon evaluating it without any operator? Such as:
Object foo;
if(foo){...}
So i can overload the evaluation with something like:
bool operator evaluation(){
bool isValid=false;
//Some instructions and conditions
return isValid;
}
There's probably little to no reason to do something like this, but I'm a bit new to C++ and I'm just exploring all nooks and crannies of it.
Thank you!

are there any benefits to use initialization instead of assignment in C++? [duplicate]

This question already has answers here:
Is there a difference between copy initialization and direct initialization?
(9 answers)
Direct Initialization vs Copy Initialization for Primitives
(4 answers)
Closed 9 years ago.
I read the following code in c++:
bool result(false);
is result initialized as false?
but are there any benefits to do it instead of:
bool result = false;
can anyone help?

Difference between constructor and initializer [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Is there a difference in C++ between copy initialization and direct initialization?
What's the difference between explicit and implicit assignment in C++
Simple as that. What is the difference between
std::string a("abc");
and
std::string a = "abc";