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

#1

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…

0 Likes

#2

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?

0 Likes

#3

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…)

0 Likes

#4

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

0 Likes

#5

I found this post from @t0m most helpful:

I use it that way in my open source project:

0 Likes

#6

Sweet, got it all sorted out now, thanks!

0 Likes