Problems with declaration of a data structure as a class member data

Hello,
I have downloaded a header file from the internet which implements a data structure. The prototype of the constructor in the .hpp file is as follows:
 
filter(const std::size_t&, const double&, const std::size_t&);

I want to declare this data structure as a class member data in my own .cc code and it seems that I have to call the constructor in my initialization list, otherwise the compiler hollers at me !. Would you please help me with your nice ideas ?

Thank you for your help,
A.
So your compiler doesn't like this?

filter myFilter;

That's strange. That would mean that the filter class is missing its default constructor. Then how did they compile their code? Can you post this header file?

I suppose you can do something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
class myClass
{
private:
   filter* pFilter;

public:
   myClass()
   {
      pFilter = new filter(5, 2.0, 5); 
     //or you get input for the filter object and pass it in to your constructor
   }

   ~myClass()
   {
      delete pFilter;
   }
};
Topic archived. No new replies allowed.