Because string is assignable from char
, and int
is implicitly convertible to char
.
More Related Contents:
- Parsing a comma-delimited std::string [duplicate]
- Remove spaces from std::string in C++
- Why should one not derive from c++ std string class?
- How to implode a vector of strings into a string (the elegant way)
- Case insensitive std::string.find()
- Is it reasonable to use std::basic_string as a contiguous buffer when targeting C++03?
- Why can’t I write to a string literal while I *can* write to a string object?
- std::strings’s capacity(), reserve() & resize() functions
- How to read and write a STL C++ string?
- initializing std::string from char* without copy
- std::string length() and size() member functions
- Why doesn’t std::string provide implicit conversion to char*?
- How can I make the map::find operation case insensitive?
- How to convert a string of hex values to a string?
- How to create string of strings in c++
- Erasing elements from a vector
- Why can’t I make a vector of references?
- Concise explanation of reference collapsing rules requested: (1) A& & -> A& , (2) A& && -> A& , (3) A&& & -> A& , and (4) A&& && -> A&&
- Right way to split an std::string into a vector
- Using custom std::set comparator
- C++ Compare char array with string
- Why is value taking setter member functions not recommended in Herb Sutter’s CppCon 2014 talk (Back to Basics: Modern C++ Style)?
- What is the proper function for comparing two C-style strings?
- How to read entire stream into a std::string?
- How to make elements of vector unique? (remove non adjacent duplicates)
- Counting the number of occurrences of a string within a string
- How can i estimate memory usage of std::map?
- Incrementing iterators: Is ++it more efficient than it++? [duplicate]
- Fastest way to Convert String to Binary?
- cin.getline() is skipping an input in C++ [duplicate]