# Std::unique\_ptr in Projucer

**URL:** <https://forum.juce.com/t/std-unique-ptr-in-projucer/27952>\
**Category:** General JUCE discussion\
**Created:** [June 1, 2018, 6:29am UTC](https://forum.juce.com/t/std-unique-ptr-in-projucer/27952 "2018-06-01T06:29:00Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikolaiaudios](https://avatars.discourse-cdn.com/v4/letter/n/77aa72/32.png) [@nikolaiaudios](https://forum.juce.com/u/nikolaiaudios)\
**Post date:** [June 1, 2018, 6:29am UTC](https://forum.juce.com/t/std-unique-ptr-in-projucer/27952/1 "2018-06-01T06:29:00Z")

</div>

Hi  
When using the UI editor in the Projucer, I see that components added now use std::unique\_ptr instead of ScopedPointer.  
Although I really like the simplicity of the ScopedPointer I guess you have your reasons for this change.  
I have one problem though, when changing a old file and resaving it, the components are now std::unique\_ptr, but the code generated by the Projucer access the components as “comp-\>setBounds(…” , should it not be “comp.get()-\>setBounds(…” ?  
at least in Clion I get errors.  
This is what Projucer outputs:

> label.reset (new Label (“new label”,  
> TRANS(“BlaBla:”)));  
> addAndMakeVisible (label.get());  
> label-\>setFont (Font (18.00f, Font::plain).withTypefaceStyle (“Regular”));  
> label-\>setJustificationType (Justification::centredLeft);  
> label-\>setEditable (false, false, false);  
> label-\>setColour (Label::textColourId, Colours::white);  
> label-\>setColour (TextEditor::textColourId, Colours::black);  
> label-\>setColour (TextEditor::backgroundColourId, Colour (0x00000000));
> 
> ```
> label->setBounds (0, 0, 184, 24);
> 
> ```

Can’t see how that would work.  
Projucer version 5.3.2

---

<div class="post-metadata">

**Author:** ![holy-city](https://avatars.discourse-cdn.com/v4/letter/h/8491ac/32.png) [@holy-city](https://forum.juce.com/u/holy-city)\
**Post date:** [June 1, 2018, 6:44am UTC](https://forum.juce.com/t/std-unique-ptr-in-projucer/27952/2 "2018-06-01T06:44:48Z")

</div>

The `->` operator is overloaded for `std::unique_ptr`.

What are the errors?

---

<div class="post-metadata">

**Author:** ![PluginPenguin](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/pluginpenguin/32/10203_2.png) [@PluginPenguin](https://forum.juce.com/u/PluginPenguin)\
**Post date:** [June 1, 2018, 8:31am UTC](https://forum.juce.com/t/std-unique-ptr-in-projucer/27952/3 "2018-06-01T08:31:13Z")

</div>

> [@Nikolai](#):
>
> at least in Clion I get errors.

I experience the CLion/AppCode syntax check to have some strange problems with std::unique\_ptr. However the compiler doesn’t complain. So do you really experience compiler errors or just CLion warnings which might be some strange JetBrains bug?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [June 1, 2018, 8:57am UTC](https://forum.juce.com/t/std-unique-ptr-in-projucer/27952/4 "2018-06-01T08:57:35Z")

</div>

@timur 🙂

---

<div class="post-metadata">

**Author:** ![Achder](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/achder/32/5897_2.png) [@Achder](https://forum.juce.com/u/Achder)\
**Post date:** [June 1, 2018, 11:31am UTC](https://forum.juce.com/t/std-unique-ptr-in-projucer/27952/5 "2018-06-01T11:31:32Z")

</div>

I once had the same problem. Back then I could solve it by changing the C++ language standard to “C++11” instead of “default (C++11)”. Maybe this still works. (Although you might want to use C++14 instead.

---

<div class="post-metadata">

**Author:** ![nikolaiaudios](https://avatars.discourse-cdn.com/v4/letter/n/77aa72/32.png) [@nikolaiaudios](https://forum.juce.com/u/nikolaiaudios)\
**Post date:** [June 1, 2018, 1:38pm UTC](https://forum.juce.com/t/std-unique-ptr-in-projucer/27952/6 "2018-06-01T13:38:05Z")

</div>

Thanks for getting back to me so fast.  
For some reason, I just merged in the latest juce tip (master), and everything was fine. Can’t really explain it.
