[Code:C++]
bool CheckSymmetry(char *File , vector<string>& vertex_set, vector<vector<string>>& edges,vector<string>& char_first)
{
.............
..........
...........
return true;
}

Here i m getting the following errors:-
error: edges' was not declared in this scope
error: `&' cannot appear in a constant-expression
error: `>>' should be `> >' within a nested template argument list

What could be possible reason for this

Recommended Answers

All 10 Replies

That function compiles ok for me using VC++ 2005 Express. Maybe you forgot the include files <string> and/or <vector> ?

I have included both of these already

then it might be something else. Post the whole program, if it isn't very large. Take the code snipped you previously posted, put it into another small program and you will see that it is ok.

#include <vector>
#include <string>
using namespace std ;

bool CheckSymmetry(char *File , vector<string>& vertex_set, vector<vector<string>>& edges,vector<string>& char_first)
{
return true;
} 

int main()
{

    return 0;
}

Put space between two templates
wrong : vector<vector<string>>& edges
good: vector<vector<string> >& edges

Thanks it worked it's causing problem as the space is not provided.

That must be a compiler thingy because VC++ 2005 Express doesn't mind it wihout the space.

ANSI-ISO C++ standart doesn't allow it. Do not believe in Microsoft at 100%

>That must be a compiler thingy because VC++ 2005 Express doesn't mind it wihout the space.
I believe Bjarne Stroustrup called this sort of thing a glorious hack. C++0x will require that the space isn't necessary anymore, but compilers have already started to adopt the new feature as an extension. Keep in mind that the current standard doesn't allow it.

>>ANSI-ISO C++ standart doesn't allow it. Do not believe in Microsoft at 100%
If the standard does not allow the space then the Microsoft compiler is doing it correctly.

>>Keep in mind that the current standard doesn't allow it.
Do you mean it does not allow the space, the space is required, or the space is optional?

>Do you mean it does not allow the space, the space is required, or the space is optional?
"It" being closing template argument lists without a space.

vector<vector<string>>

Is illegal in the current standard, legal in the next, but several compilers offer it as an extension for the current standard.

vector<vector<string> >

Is legal across the board. And of course:

vector< vector<string> >

Is a cutsie way to format your template arguments legally without the annoying asymmetry of greedy token parsing rules.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.