ParameterLayout (const ParameterLayout &other)=delete - Why?

I’m creating a parameterLayout in my configurationManager class. However this member function of my class doesn’t work:

AudioProcessorValueTreeState::ParameterLayout ConfigurationManager::createParameterLayout()
{
	return m_pLayout;
}

The compiler tells me that it is a deleted function. Why is that? The brute-force method of course would be to make my parameterLayout public…

ParameterLayout cannot be copied because it contains a std::vector<std::unique_ptr> and std::unique_ptr cannot be copied.
Now the question is, what exactly are you trying to do?

They’ve disabled the copy constructor for ParameterLayout to signify that they shouldn’t be copied. You could try returning a reference or const reference to the layout in your method. (Or move it to the return value with std::move, but that would make the ConfigurationManager class member m_pLayout invalid for later use…)

ok, that makes sense! I wanted to generate my parameterLayout before calling createParameterLayout(). I will try the reference, thanks!

I found this post from @t0m most helpful:

I use it that way in my open source project:

Sweet, got it all sorted out now, thanks!