O
Old Wolf
My compiler's <string> header has this constructor
(after preprocessing):
template <class charT, class traits , class Allocator >
class basic_string
{
template <class InputIterator>
basic_string (InputIterator, InputIterator,
const Allocator& = Allocator()));
//.........
};
That means that some code like:
unsigned char a[10];
std::string s(a, a+10);
does not give a compiler error, but it does give a link error
because no body is ever defined for that constructor.
Should there be a body, or should this constructor not be
present at all? I have worked around it by writing my own
function body into <string> .
(after preprocessing):
template <class charT, class traits , class Allocator >
class basic_string
{
template <class InputIterator>
basic_string (InputIterator, InputIterator,
const Allocator& = Allocator()));
//.........
};
That means that some code like:
unsigned char a[10];
std::string s(a, a+10);
does not give a compiler error, but it does give a link error
because no body is ever defined for that constructor.
Should there be a body, or should this constructor not be
present at all? I have worked around it by writing my own
function body into <string> .