title: c++ how to create a std::vector of functors
body: <pre><code>class A
  {
  public:
      int x;
      //create a vector of functors in B and C here
  };
  
  class B
  {
  public:
      struct bFunctor
      {
          void operator()() const
          {
              //some code
          }
      };
  };
  
  class C
  {
  public:
      struct cFunctor
      {
          void operator()() const
          {
              //some code
          }
      };
  
  };
  
  void main()
  {
   A obj;
   //iterate through the vector in A and call the functors in B and C
  }
  </code></pre>
  
  <p>My question is what should be the format of the <code>vector</code> in class <code>A</code> for calling <code>functors</code> in <code>B</code> and <code>C</code>? Or is the only way this is possible to have a base <code>functor</code> in <code>A</code> and make the <code>functors</code> in <code>B</code> and <code>C</code> derive from it? Or is there a better approach?</p>