Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes writes: | Le 23/10/12 21:18, Lars Gullik Bjønnes a écrit : >> | Concerning auto, I am still not sure that I like it. >> >> Liking it took me some 5 seconds. >> >> Auto suddenly makes it nice to work with the complex types you get in >> C++. >> >> Imagine: >> >> auto func = []

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes
Le 23/10/12 21:18, Lars Gullik Bjønnes a écrit : | Concerning auto, I am still not sure that I like it. Liking it took me some 5 seconds. Auto suddenly makes it nice to work with the complex types you get in C++. Imagine: auto func = [](){}; func(); try to figure out what type func really is

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes
Le 23/10/12 21:21, Lars Gullik Bjønnes a écrit : | FWIW, we already define lyx::assert, lyx::shared_ptr, lyx::bind. To note: the lyx::shared_ptr is there _because_ of the "using namespace std", and the pollution that drags in on some compilers. I know :) JMarc

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread André Pönitz
On Tue, Oct 23, 2012 at 02:27:14PM +0200, Lars Gullik Bjønnes wrote: > lar...@gullik.org (Lars Gullik Bjønnes) writes: > > | Jean-Marc Lasgouttes writes: > > > | | Le 23/10/12 01:21, Lars Gullik Bjønnes a écrit : > >>> Anyhow... I am going to ditch the hole series. Pick what you want from > >>> i

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Lars Gullik Bjønnes
Abdelrazak Younes writes: | On Tue, Oct 23, 2012 at 2:27 PM, Lars Gullik Bjønnes wrote: >> C++11 would make the code look a lot nicer, esp. thru the use of range >> based for, and auto: >> >> std::vector::iterator at = somevec.begin(); >> std::vector::iterator end = someved.end(); >>

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes writes: | Le 23/10/2012 15:41, Abdelrazak Younes a écrit : >> I really don't understand the rationale, sorry. I'd consider very bad >> style to create our own lyx::vector or lyx::iostream, so what's the >> point? > | FWIW, we already define lyx::assert, lyx::shared_ptr, lyx::

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes writes: | Le 23/10/2012 14:27, Lars Gullik Bjønnes a écrit : >> C++11 would make the code look a lot nicer, esp. thru the use of range >> based for, and auto: >> >> std::vector::iterator at = somevec.begin(); >> std::vector::iterator end = someved.end(); >> for

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes
Le 23/10/2012 15:41, Abdelrazak Younes a écrit : I really don't understand the rationale, sorry. I'd consider very bad style to create our own lyx::vector or lyx::iostream, so what's the point? FWIW, we already define lyx::assert, lyx::shared_ptr, lyx::bind. I do not have a strong view on this

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Abdelrazak Younes
On Tue, Oct 23, 2012 at 2:27 PM, Lars Gullik Bjønnes wrote: > C++11 would make the code look a lot nicer, esp. thru the use of range > based for, and auto: > > std::vector::iterator at = somevec.begin(); > std::vector::iterator end = someved.end(); > for (; at != end; ++at) { >

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Abdelrazak Younes
On Tue, Oct 23, 2012 at 3:12 PM, Jean-Marc Lasgouttes wrote: > Le 23/10/2012 14:27, Lars Gullik Bjønnes a écrit : > >> | What I think you should do is to remove the "using namespace std", and >> | add std:: wherever needed except for on string, as that really is all >> | over, and use "using std::

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes
Le 23/10/2012 14:27, Lars Gullik Bjønnes a écrit : | What I think you should do is to remove the "using namespace std", and | add std:: wherever needed except for on string, as that really is all | over, and use "using std::string" for that. A patch that does exactly that is attached. I would

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes
Le 23/10/2012 14:27, Lars Gullik Bjønnes a écrit : C++11 would make the code look a lot nicer, esp. thru the use of range based for, and auto: std::vector::iterator at = somevec.begin(); std::vector::iterator end = someved.end(); for (; at != end; ++at) { ... } woul

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes writes: | Le 23/10/12 01:21, Lars Gullik Bjønnes a écrit : >> Anyhow... I am going to ditch the hole series. Pick what you want from >> it if anything. >> >> I just cannot stand the hostility. > | Come on. André is bored and he feel happy to be rude like in the good | old day

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-23 Thread Jean-Marc Lasgouttes
Le 23/10/12 01:21, Lars Gullik Bjønnes a écrit : Anyhow... I am going to ditch the hole series. Pick what you want from it if anything. I just cannot stand the hostility. Come on. André is bored and he feel happy to be rude like in the good old days. Nothing really personnal :) Apart from t

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-22 Thread Lars Gullik Bjønnes
Richard Heck writes: | On 10/21/2012 03:11 PM, Lars Gullik Bjønnes wrote: >> Using std::make_shared (and in our case for the time being >> boost::make_shared) >> is the preferred way of creating a std::shared_ptr. >> | Can we get some kind if mini-tutorial here, then, on how to use this | routin

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-22 Thread Lars Gullik Bjønnes
Richard Heck writes: | On 10/21/2012 03:11 PM, Lars Gullik Bjønnes wrote: >> Using std::make_shared (and in our case for the time being >> boost::make_shared) >> is the preferred way of creating a std::shared_ptr. >> | Can we get some kind if mini-tutorial here, then, on how to use this | routin

Re: [PATCH 11/13] Use make_shared to create shared_ptr

2012-10-22 Thread Richard Heck
On 10/21/2012 03:11 PM, Lars Gullik Bjønnes wrote: Using std::make_shared (and in our case for the time being boost::make_shared) is the preferred way of creating a std::shared_ptr. Can we get some kind if mini-tutorial here, then, on how to use this routine? I see several different ways it's p

[PATCH 11/13] Use make_shared to create shared_ptr

2012-10-21 Thread Lars Gullik Bjønnes
Using std::make_shared (and in our case for the time being boost::make_shared) is the preferred way of creating a std::shared_ptr. This is mainly due to two aspects: - half the number of allocations required - potential of using less space, and better locality Also a failed creation of t