'find_if to seach abstract object list with std::string

I have a list which contains abstract objects and now I need to use a string search to the list to compare object's name and the string. Here is the abstract class.

class ShaderEffect {
  std::string subroutine_name_;
 public:
  [[nodiscard]] std::string GetSubroutineName() const {
    return subroutine_name_;
  }
  virtual void Set(const Params& t) = 0;
};

Here is the how I use find_if, but I got compilation error says "cannot convert argument 1 from '_Ty' to 'const ShaderEffect &'"

const std::string& effect;
std::array<std::unique_ptr<ShaderEffect>, 10> all_effects_;
auto found = std::find_if(std::begin(all_effects_), std::end(all_effects_),
                         [effect](const ShaderEffect& f) -> bool {
                           return f.GetSubroutineName() == effect;
                         }); 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source