#include <memory>

With JUCE is it necessary to insert the #include <memory> preprocessing directive - anywhere?

Smart pointers are used often enough in JUCE and its projects, yet I have not been able to find this preprocessor directive applied in any tutorials or in the JUCE modules.

My own understanding of the use of #include <memory> comes from Beginning C++17 by Horton and Van Weert:

Smart pointer types are defined by templates inside the memory header of the Standard Library, so you
must include this in your source file to use them. (emphasis mine)

Does JUCE somehow somewhere handle this preprocessor directive for the developer? If so what other preprocessor directives are handled by JUCE on behalf of the developer?

It’s included in the juce_core/system/juce_StandardHeader.h file inside your JUCE modules folder, along with a number of other commonly-used headers.

1 Like

Thank you