Using the C++ standard algorithms with object methods will help developers write shorter, better performing, and easier to read code. In this video Jason Turner demonstrates both a common method of applying a standard algorithm, and a superior approach to using member functions with standard algorithms that optimize compilation. Following along in Compiler Explorer, intermediate C++ developers will walk away with an expanded algorithm toolkit and be able to apply algorithms in more contexts.

Continue learning C++ in our Beginning C++ Learning Path.


Jason Turner is a Microsoft MVP certified trainer backed by over 12 years of experience as a C++ developer. An active member of the C++ community who has spoken at CppCon and C++Now, Jason is the ongoing co-host of of CppCast, a podcast for C++ developers. Jason is also the co-creator and maintainer of the embedded C++ scripting language, ChaiScript, and the author and curator of the collaborative coding standards document, C++ Best Practices.

Article image: Screenshot from "How do you use standard algorithms with object methods in C++?" (source: O'Reilly).