Applying chain responsibility with IFilter I have an interface IFilter and more types of filters: Filter1, Filter2, Filter3; that I want to call one after the other and if the result of one is empty, then I want to stop the process. For this I have thought of:

class FiltersSequence
{
private:
    std::vector&lt; IFilter &gt; m_filters;

public:
    FiltersSequence();
    ~FiltersSequence();

    /**/
    ObjectToFilter execute(const ObjectToFilter&amp; objectToFilterIn);
};


With the implementations:

FiltersSequence::FiltersSequence()
{
    m_filters.push_back(Filter3());
    m_filters.push_back(Filter2());
    m_filters.push_back(Filter1());
}

FiltersSequence::~FiltersSequence() {}

ObjectToFilter FiltersSequence::execute(const ObjectToFilter&amp; objectToFilterIn)
{
    ObjectToFilter filterResult = objectToFilterIn;

    for (std::size_t i = 0; i &lt; m_filters.size(); i++)
    {
        filterResult = m_filters[i].execute();
        if (filterResult.isEmpty())
        {
            return filterResult;
        }
    }

    return filterResult;
}


It should be vector of pointers, because the filters are not all the same size; so I have changed to:

std::vector&lt; std::shared_ptr&lt; IFilter &gt; &gt; m_filters;


and 

m_filters.push_back(std::shared_ptr&lt; IFilter &gt;(new FilterX()));


I thought of something like having a map&lt; std::string, IFilter &gt; for being sure that the sequence is in the order that I want. What do you think of this? Is it good enough? Or this is just making it more complicated and I need just to pay attention at push_back. BTW, is this going to call them in right order (1, 2, 3)?
I thought of something like having a map&lt; std::string, IFilter > for
  being sure that the sequence is in the order that I want. What do you
  think of this?


std::map for such simple case should be avoided. std::map would be more appropriate if you are not sure that your IFilter objects could be inserted in any order by client code and you do have lots of entry. Of course we should measure our program performance by both(.i.e. std::vector or std::map


  Is it good enough? Or this is just making it more complicated and I
  need just to pay attention at push_back.


Yes, it look ok. We should always use more simpler/efficient data structure(std::vector) as our default container unless we have valid reason to do otherwise. 

BTW, is this going to call them in right order (1, 2, 3)?


No, It would be in order of (3,2,1) as std::vector would push_back. We can see that documentation clearly mention like this about push_back

Appends the given element value to the end of the container.



[Filter3()][Filter2()][Filter1()]
   0           1          2