How to add STL object as member?

I would like to build a class having a set of integers:

set1.h
--------------------------
#include <set>
class set1{
set<int> integers;
...
};
--------------------------

main.cpp
------------------------
#include "set1.h"
main()
{
return 0;
}
----------------------
When I tried to compile it using G++, some errors were reflected:
error: ISO C++ forbids declaration of ‘set’ with no type
error: expected ‘;’ before ‘<’ token
...
and below are many errors complaining the member "integers" was not declared.

What should I do to solve this problem?
Last edited on
I don't if this will solve your problem, but perhaps you need to use std::set<int> integers; instead.
Oh!!! It works !!!
thanks for your reply.
Alternatively a quick using namespace std; is quite likely to save you some typing.
However, I would prefer some extra typing to some extra debugging... namespaces are there for a reason, people.
Topic archived. No new replies allowed.