D
Default User
I received some code from another programmer who happens to be out of
town. In this, he had something like:
struct st
{
std::string s<20>;
};
Looks like it's setting the string size.
VC++ 6 produced an error in compilation, complaining of a syntax error
before the <20> part. I looked at Stroustrup and Josuttis to see if I
could find something about a non-type template argument for doing this,
and didn't really see anything, although I may have just not realized I
was seeing it. I didn't see any examples similar to this either.
Normally when I want to specify string size at declaration, I use the
constructor:
std::string s(20, 0);
Presumably this guy had compiled it on whatever platform he uses
without problem, although I can't check with him. Is this an error on
his part, or yet another VC++ template problem?
Brian
town. In this, he had something like:
struct st
{
std::string s<20>;
};
Looks like it's setting the string size.
VC++ 6 produced an error in compilation, complaining of a syntax error
before the <20> part. I looked at Stroustrup and Josuttis to see if I
could find something about a non-type template argument for doing this,
and didn't really see anything, although I may have just not realized I
was seeing it. I didn't see any examples similar to this either.
Normally when I want to specify string size at declaration, I use the
constructor:
std::string s(20, 0);
Presumably this guy had compiled it on whatever platform he uses
without problem, although I can't check with him. Is this an error on
his part, or yet another VC++ template problem?
Brian