On Fri, Jun 5, 2015 at 4:38 AM, Max Linke <max_li...@gmx.de> wrote:

>
>
> 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.


The downside comes when you need to read someone else's code :P.

We should follow the google C++ style guide here -- which is somewhere
between Daniel and Max on this point:
https://google-styleguide.googlecode.com/svn/trunk/cppguide.html#auto

Which can pretty much be summarized as "use auto to prevent repeating
yourself".


> 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.
>

+1 -- make_unique is great. make_shared is c++11 I believe.


> 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
>
------------------------------------------------------------------------------
_______________________________________________
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