On 06/05/2015 09:55 AM, Daniel Schürmann wrote:
> Hi all.
>
> Good news! Thank you RJ.
>
> I just one objection to the C++11 white list.
>
> The new keyword "auto".


No auto is awesome. I've started a new simulation Montecarlo simulation 
program for my PhD and use exclusively auto to declare my variables. So 
far I was never surprised by type and I get the benefit that I force the 
compiler to check that each of my variables is initialized, incredibly 
useful!

At first it seems a bit odd but once you are used to only using auto it 
gets convenient with no noticeable downside.

A good post on that topic is.

http://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-always-auto/

I can also recommend the chapter about 'auto' in Effective Modern C++


> 2015-06-05 6:43 GMT+02:00 RJ Ryan <rr...@mixxx.org>:
>
>> Mixxx is switching to C++11! The master branch now has -std=c++11 turned
>> on. 1.12 will be the last release without C++11 support.
>>
>> This means we have new minimum requirements for compilers:
>> * Visual Studio 2013 (12.0)
>> * GCC 4.8 (supported on Ubuntu 14.04 and up)
>> * Clang 3.3 (supported on Ubuntu 14.04 and up. Supported on XCode 4.4 and
>> higher)

Nice

** Backport some C++14 stuff **

We should introduce a compat header to backport some useful C++14 stuff. 
This can be done rather easily because it is just a minor addition to 
C++11. A obvious one is the make_unique and make_shared template.

namespace std {

// we use C++11 as a minimum requirment. make_unique was added in C++14 
to the
// standard. So always use this.
template <typename T, typename... Ts>
std::unique_ptr<T> make_unique(Ts&&... params) {
   return std::unique_ptr<T>(new T(std::forward<Ts>(params)...));
}

template <typename T, typename... Ts>
std::shared_ptr<T> make_shared(Ts&&... params) {
   return std::shared_ptr<T>(new T(std::forward<Ts>(params)...));
}

} // namespace std


This sure that we allocate the smartpointer and real pointer adjacent to 
each other in ram, It can be later used like

auto tmp = make_unique<QWidget>(var1, var2, var3);

------------------------------------------------------------------------------
_______________________________________________
Get Mixxx, the #1 Free MP3 DJ Mixing software Today
http://mixxx.org


Mixxx-devel mailing list
Mixxx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to