// { dg-do assemble }
|
// { dg-do assemble }
|
#include
|
#include
|
#include
|
#include
|
#include
|
#include
|
#include
|
#include
|
|
|
using namespace std;
|
using namespace std;
|
|
|
// empty parameter class with a minimal set of operations
|
// empty parameter class with a minimal set of operations
|
// if there are no weights for edges necessary
|
// if there are no weights for edges necessary
|
struct Empty
|
struct Empty
|
{
|
{
|
public:
|
public:
|
Empty(int=0) {}
|
Empty(int=0) {}
|
bool operator<(const Empty&) const { return true;}
|
bool operator<(const Empty&) const { return true;}
|
};
|
};
|
inline ostream& operator<<(ostream& os, const Empty&) { return os;}
|
inline ostream& operator<<(ostream& os, const Empty&) { return os;}
|
inline istream& operator>>(istream& is, Empty& ) { return is;}
|
inline istream& operator>>(istream& is, Empty& ) { return is;}
|
|
|
|
|
template
|
template
|
class Graph
|
class Graph
|
{ // { dg-error "" } candidates
|
{ // { dg-error "" } candidates
|
public:
|
public:
|
// public type interface
|
// public type interface
|
typedef std::map Successor;
|
typedef std::map Successor;
|
typedef std::pair vertex;
|
typedef std::pair vertex;
|
typedef std::vector GraphType;
|
typedef std::vector GraphType;
|
typedef typename GraphType::iterator iterator;
|
typedef typename GraphType::iterator iterator;
|
typedef typename GraphType::const_iterator const_iterator;
|
typedef typename GraphType::const_iterator const_iterator;
|
|
|
// a lot of stuff deleted ....
|
// a lot of stuff deleted ....
|
|
|
private:
|
private:
|
bool directed;
|
bool directed;
|
GraphType C; // container
|
GraphType C; // container
|
ostream* pOut;
|
ostream* pOut;
|
};
|
};
|
|
|
// all graph-methods delet
|
// all graph-methods delet
|
template
|
template
|
ostream& operator<<(ostream& os, Graph& G)
|
ostream& operator<<(ostream& os, Graph& G)
|
{
|
{
|
// display of vertices with successors
|
// display of vertices with successors
|
for(int i = 0; i < G.size(); ++i) // { dg-error "" } no size function
|
for(int i = 0; i < G.size(); ++i) // { dg-error "" } no size function
|
{
|
{
|
os << G[i].first << " <"; // { dg-error "" } no index operator
|
os << G[i].first << " <"; // { dg-error "" } no index operator
|
|
|
// The compiler does not like this line!!!!!!
|
// The compiler does not like this line!!!!!!
|
typename Graph::Successor::iterator
|
typename Graph::Successor::iterator
|
startN = G[i].second.begin(), // { dg-error "" } no index operator
|
startN = G[i].second.begin(), // { dg-error "" } no index operator
|
endN = G[i].second.end(); // { dg-error "" } no index operator
|
endN = G[i].second.end(); // { dg-error "" } no index operator
|
|
|
while(startN != endN)
|
while(startN != endN)
|
{
|
{
|
os << G[(*startN).first].first << ' ' // { dg-error "" } no index operator
|
os << G[(*startN).first].first << ' ' // { dg-error "" } no index operator
|
<< (*startN).second << ' ';
|
<< (*startN).second << ' ';
|
++startN;
|
++startN;
|
}
|
}
|
os << ">\n";
|
os << ">\n";
|
}
|
}
|
return os;
|
return os;
|
}
|
}
|
|
|
int main()
|
int main()
|
{
|
{
|
// no edge weighting, therefore type Empty:
|
// no edge weighting, therefore type Empty:
|
Graph V(true); // { dg-error "" } no bool constructor
|
Graph V(true); // { dg-error "" } no bool constructor
|
// ReadGraph(V, "gra1.dat");
|
// ReadGraph(V, "gra1.dat");
|
|
|
// display of vertices with successors
|
// display of vertices with successors
|
cout << V;
|
cout << V;
|
|
|
}
|
}
|
|
|