Re: C++ question about auto_ptr

2015-05-09 Thread Jean-Marc Lasgouttes
Le 08/05/2015 23:10, Georg Baum a écrit : I have many places like in the patch below. Is there a reason why I should keep the auto_ptr instead of a naked pointer? What is it good for? Usually it is used for exception safety: If you use a raw pointer, you need to delete it in the catch clause, e

Re: C++ question about auto_ptr

2015-05-09 Thread Abdelrazak Younes
On 09/05/2015 11:37, Jean-Marc Lasgouttes wrote: Le 09/05/2015 09:18, Abdelrazak Younes a écrit : On 08/05/2015 22:13, Jean-Marc Lasgouttes wrote: With C++11, auto_ptr is deprecated and we get warnings. I am trying to see how we can get rid of it. unique_ptr is new to C++11, so I'd rather avoi

Re: C++ question about auto_ptr

2015-05-09 Thread Jean-Marc Lasgouttes
Le 09/05/2015 09:18, Abdelrazak Younes a écrit : On 08/05/2015 22:13, Jean-Marc Lasgouttes wrote: With C++11, auto_ptr is deprecated and we get warnings. I am trying to see how we can get rid of it. unique_ptr is new to C++11, so I'd rather avoid that. Why that? unique_ptr is supported since

Re: C++ question about auto_ptr

2015-05-09 Thread Abdelrazak Younes
On 08/05/2015 22:13, Jean-Marc Lasgouttes wrote: With C++11, auto_ptr is deprecated and we get warnings. I am trying to see how we can get rid of it. unique_ptr is new to C++11, so I'd rather avoid that. Why that? unique_ptr is supported since gcc 4.4 released in 2009: https://gcc.gnu.org/gc

Re: C++ question about auto_ptr

2015-05-08 Thread Georg Baum
Jean-Marc Lasgouttes wrote: > With C++11, auto_ptr is deprecated and we get warnings. > > I am trying to see how we can get rid of it. unique_ptr is new to C++11, > so I'd rather avoid that. Why not use unique_ptr fpr C++11 and auto_ptr else? The difference is in the copying semantics, which do

Re: C++ question about const

2015-04-25 Thread Scott Kostyshak
On Sat, Apr 25, 2015 at 3:42 PM, Vincent van Ravesteijn wrote: > Scott Kostyshak schreef op 22-4-2015 om 3:37: > > In many cases variables are defined const because they are not going to be > changed. This does not mean that it was not allowed to be changed by design. > > In this case, I would ju

Re: C++ question about const

2015-04-25 Thread Vincent van Ravesteijn
Scott Kostyshak schreef op 22-4-2015 om 3:37: My question is in regards to the patch I propose for #6173: http://www.lyx.org/trac/attachment/ticket/6173/0001-Update-previews-when-going-to-a-bookmark-6173.patch I move the definition of cur up because I need it before the return. I then need to pa

Re: C-question

2006-04-09 Thread Bo Peng
> There is no need for the cast in C (as the conversion is automatic), I have not checked C99 standard on this issue, but C has improved on such things and may no longer allow this dangerous implicit conversion. > and there is no need for malloc in C++ (as there's 'new' etc). Right. Poeple still

Re: C-question

2006-04-09 Thread Andre Poenitz
On Fri, Apr 07, 2006 at 08:42:45PM -0500, Bo Peng wrote: > > commandLine = malloc (commandLineLength); > > commandLine = (char*)malloc (commandLineLength); > > Usually (to be safe, and is the case for any other type), > > commandLine = (char*)malloc (commandLineLength*sizeof(char)); There i

Re: C-question

2006-04-08 Thread Uwe Stöhr
Bo Peng wrote: commandLine = malloc (commandLineLength); commandLine = (char*)malloc (commandLineLength); Many thanks for this. I works and I can now start MSYS. regards Uwe

Re: C-question

2006-04-07 Thread Enrico Forestieri
On Sat, Apr 08, 2006 at 03:39:40AM +0200, Uwe Stöhr wrote: > Could anybody help me with a little C-Problem. Attached is a small > sourcecode that I have to compile. G++ tells me: > > D:\LyXSVN>g++ createprocess.c -o CreateProcess.exe > createprocess.c: In function `int main(int, char**)': > crea

Re: C-question

2006-04-07 Thread Bo Peng
> commandLine = malloc (commandLineLength); commandLine = (char*)malloc (commandLineLength); Usually (to be safe, and is the case for any other type), commandLine = (char*)malloc (commandLineLength*sizeof(char)); Bo

Re: C++ question

2005-06-11 Thread Andre Poenitz
On Sun, Jun 05, 2005 at 09:41:26PM +0100, Angus Leeming wrote: > I feel like a bit of an idiot asking this, but what's the C++ way to insert > some data into an existing file? Write a new one. It's about the only way that has certain guarantees to work without sacrificing black roosters. Andre'

Re: C++ question

2005-06-06 Thread Angus Leeming
Lars Gullik Bjønnes wrote: | I feel like a bit of an idiot asking this, but what's the C++ way to | insert some data into an existing file? How would you do it in any other language? At end is easy. At start is more tricky... If it were a memory buffer how would you do it then? (memmove perhap

Re: C++ question

2005-06-05 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | I feel like a bit of an idiot asking this, but what's the C++ way to | insert some data into an existing file? How would you do it in any other language? At end is easy. At start is more tricky... If it were a memory buffer how would you do it then? (

Re: C++ question. Is this safe?

2005-02-20 Thread Asger Ottar Alstrup
Andre Poenitz wrote: I am not sure the message is valid. Sure, the compiler sees a tmporary and returning a reference to a part of something refered to by the temporary. However, that thing is not a temporary but lives in a structure outside. The compiler does not know, but we do. So my guess is t

Re: C++ question. Is this safe?

2005-02-19 Thread Andre Poenitz
On Tue, Feb 15, 2005 at 10:58:13AM +, Angus Leeming wrote: > class Mover {...}; > class SpecialisedMover : public Mover {...}; > > class Movers { > public: > /// @c returns the Mover registered for format @c fmt. > Mover const & operator()(std::string const & fmt) const > { >

Re: C++ question. Is this safe?

2005-02-15 Thread Asger Alstrup
Angus Leeming wrote: I read that as saying that the code in the mail at the start of this thread is perfectly safe, don't you? Well, we also have: template class _Tree { const_iterator find(const key_type& _Keyval) const { // find an element in nonmutable seque

Re: C++ question. Is this safe?

2005-02-15 Thread Angus Leeming
Asger Alstrup wrote: > Angus Leeming wrote: >> That will require an MSVC user (Asger) to check his >> std::map::const_iterator implementation. > > I'm not sure this is what you are looking for, but here is some of the > code for the map::const_iterator in MSVC 7.1: > > class const_iterator > : p

Re: C++ question. Is this safe?

2005-02-15 Thread Asger Alstrup
Angus Leeming wrote: That will require an MSVC user (Asger) to check his std::map::const_iterator implementation. I'm not sure this is what you are looking for, but here is some of the code for the map::const_iterator in MSVC 7.1: class const_iterator : public _Bidit

Re: C++ question. Is this safe?

2005-02-15 Thread Angus Leeming
Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > > | class Mover {...}; > | class SpecialisedMover : public Mover {...}; >> > | class Movers { > | public: > | /// @c returns the Mover registered for format @c fmt. > | Mover const & operator()(std::string const & f

Re: C++ question. Is this safe?

2005-02-15 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | class Mover {...}; | class SpecialisedMover : public Mover {...}; > | class Movers { | public: | /// @c returns the Mover registered for format @c fmt. | Mover const & operator()(std::string const & fmt) const | { | SpecialsMap::cons

Re: C++ question

2003-09-24 Thread Angus Leeming
On Wednesday 24 September 2003 1:44 pm, Andre Poenitz wrote: > On Wed, Sep 24, 2003 at 02:29:44PM +, Angus Leeming wrote: > > Which doesn't help us much... > > What why do you need that vector? I guess I don't ;-) Angus namespace { template void clearIfNotFound(T & data, Enum value, vector

Re: C++ question

2003-09-24 Thread Andre Poenitz
On Wed, Sep 24, 2003 at 02:29:44PM +, Angus Leeming wrote: > Which doesn't help us much... What why do you need that vector? Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson or B. Franklin or both...)

Re: C++ question

2003-09-24 Thread Angus Leeming
Andre Poenitz wrote: > On Wed, Sep 24, 2003 at 01:55:09PM +, Angus Leeming wrote: >> Given an enum, is there a semi-automated way of returning a vector of >> all named enum values? The best I can come up with is this: > > None that I am aware of. > > Actually, your solution does not work for

Re: C++ question

2003-09-24 Thread Andre Poenitz
On Wed, Sep 24, 2003 at 01:55:09PM +, Angus Leeming wrote: > Given an enum, is there a semi-automated way of returning a vector of all > named enum values? The best I can come up with is this: None that I am aware of. Actually, your solution does not work for e.g. enum TransformID {

Re: C++ question

2003-06-12 Thread Andre Poenitz
On Thu, Jun 12, 2003 at 09:02:20AM +, Angus Leeming wrote: > Andre Poenitz wrote: > > The generated once will call the cctor and operator= of the base "once" *sigh* I really wonder why people write "phonetically"... Does that mean we think, formulate audible words and write them down using s

Re: C++ question

2003-06-12 Thread Angus Leeming
Andre Poenitz wrote: > On Wed, Jun 11, 2003 at 07:29:17PM +, Angus Leeming wrote: >> class Derived : public Base { >> ??? >> }; >> >> The question is, do I need to define explicit copy c-tor and operator= >> for Derived to ensure that Base's copy c-tor, operator= is used? > > No. >

Re: C++ question

2003-06-12 Thread Andre Poenitz
On Wed, Jun 11, 2003 at 07:29:17PM +, Angus Leeming wrote: > class Derived : public Base { > ??? > }; > > The question is, do I need to define explicit copy c-tor and operator= for > Derived to ensure that Base's copy c-tor, operator= is used? No. The generated once will call the c

Re: C++ question

2003-02-14 Thread Andre Poenitz
On Fri, Feb 14, 2003 at 01:43:50PM +, Angus Leeming wrote: > why does this compile: > string data = ...; > istringstream datastream(data); > LyXLex lex(0,0); > lex.setStream(datastream); > > and this not: > LyXLex lex(0,0); > lex.setStream(istri

Re: C++ question

2002-10-31 Thread Andre Poenitz
> I read the recent thread about casting Insets up to > their "real" type and thought I'd try and implement André's > asAInset, asBInset, asCInset thing using templates. > > Unfortunately, it doesn't compile :-( > > Is their anyway to do this? No, you can't have templated virtual member functions.

Re: C++ question

2002-10-31 Thread Angus Leeming
On Thursday 31 October 2002 11:21 am, Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > | On Thursday 31 October 2002 10:57 am, Lars Gullik Bjønnes wrote: > >> Angus Leeming <[EMAIL PROTECTED]> writes: > >> | I read the recent thread about casting Insets up to > >> | their "r

Re: C++ question

2002-10-31 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Anyway, to answer your call for testers, this is what happens here: I just tested with gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) this does not have member templates, but dynamic_cast work as expected. To me this implies that all g

Re: C++ question

2002-10-31 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | On Thursday 31 October 2002 10:57 am, Lars Gullik Bjønnes wrote: >> Angus Leeming <[EMAIL PROTECTED]> writes: >> | I read the recent thread about casting Insets up to >> | their "real" type and thought I'd try and implement André's >> | asAInset, asBInse

Re: C++ question

2002-10-31 Thread Angus Leeming
On Thursday 31 October 2002 10:57 am, Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > | I read the recent thread about casting Insets up to > | their "real" type and thought I'd try and implement André's > | asAInset, asBInset, asCInset thing using templates. > | > | Unfort

Re: C++ question

2002-10-31 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | I read the recent thread about casting Insets up to | their "real" type and thought I'd try and implement André's | asAInset, asBInset, asCInset thing using templates. > | Unfortunately, it doesn't compile :-( > | Is their anyway to do this? Yes, by u

Re: C++ question

2002-07-22 Thread John Levon
On Mon, Jul 22, 2002 at 12:35:33PM +0200, Lars Gullik Bjønnes wrote: > You could do as they do in the stl and take a reference are, but store > the pointer. We should probably introduce a new smartpointer for that > then. > > held_ptr<> perhaps. I like this (though it still means I have to have

Re: C++ question

2002-07-22 Thread Lars Gullik Bjønnes
John Levon <[EMAIL PROTECTED]> writes: | What is the standard way to get around the icky std::map requirement | that the value object have a default ctor ? This is forcing me to not | only havea pointless default no-argument ctor, but stop using references | in the struct value for no good reason

Re: C++ question

2002-04-26 Thread Andre Poenitz
On Thu, Apr 25, 2002 at 04:02:04PM +0200, Lars Gullik Bjønnes wrote: > outside foo > outside foo inside anon namespace > inside foo... > > but there is one variant that is not allowed... If there is one it might be the one in anon namespace. Reasoning along the lines of: Suppose we had a compil

Re: C++ question

2002-04-25 Thread Lars Gullik Bjønnes
[EMAIL PROTECTED] (Lars Gullik Bjønnes) writes: | | if (it == end) { | | std::cout << c << " not found" << std::endl; | | } else { | | std::cout << c << " found at pos " | | << it - b

Re: C++ question

2002-04-25 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | #include | #include | #include > | using std::string; > | class Foo { | public: | class Functor { | public: | Functor(char cin) : c(cin) {} | bool operator()(char comp) { return c == comp; } | p

Re: C++ question

2002-04-25 Thread Angus Leeming
On Thursday 25 April 2002 12:48 pm, Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > >> class Foo { > >> class Functor {}; > >> > >> void do_stuff() { > >>find_if(..., Functor()); > >> } > >> }; > | > | I'm hazy about why not. Because it can go

Re: C++ question

2002-04-25 Thread Lars Gullik Bjønnes
Andre Poenitz <[EMAIL PROTECTED]> writes: | On Thu, Apr 25, 2002 at 01:40:05PM +0200, Lars Gullik Bjønnes wrote: >> What's not ok is using local classes for this: > | Is this written somewhere? Yes, I belive so. I have seen references to this both at the boost list and comp.lang.c++.moderated.

Re: C++ question

2002-04-25 Thread Andre Poenitz
On Thu, Apr 25, 2002 at 01:40:05PM +0200, Lars Gullik Bjønnes wrote: > What's not ok is using local classes for this: Is this written somewhere? Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)

Re: C++ question

2002-04-25 Thread Andre Poenitz
On Thu, Apr 25, 2002 at 12:35:11PM +0100, Angus Leeming wrote: > What's the official take on putting functors in namespace anon and then > passing them to an STL routine? That's not forbidden as far as I know. But I am not really sure. Andre' -- Those who desire to give up Freedom in order to

Re: C++ question

2002-04-25 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: >> class Foo { >> class Functor {}; >> >> void do_stuff() { >>find_if(..., Functor()); >> } >> }; > | I'm hazy about why not. Because it can go out of scope? See, hazy! Could you | lift my fog? I am not really sure, but jus

Re: C++ question

2002-04-25 Thread Angus Leeming
On Thursday 25 April 2002 12:40 pm, Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > | What's the official take on putting functors in namespace anon and then > | passing them to an STL routine? > | > | Here, I get warnings like: > | cxx: Warning: /usr/include/cxx/algorithm

Re: C++ question

2002-04-25 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | What's the official take on putting functors in namespace anon and then | passing them to an STL routine? > | Here, I get warnings like: | cxx: Warning: /usr/include/cxx/algorithm.cc, line 110: #1115-D external | routine | uses unnamed type

Re: C++ question

2002-04-18 Thread Angus Leeming
On Thursday 18 April 2002 10:18 am, Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > | Do you have any opinions about which way I should go? > > No, not really. > > - be as const as possible > - all class functions that are logically const should be const. > > That's the ru

Re: C++ question

2002-04-18 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Do you have any opinions about which way I should go? No, not really. - be as const as possible - all class functions that are logically const should be const. That's the rules I use. -- Lgb

Re: C++ question

2002-04-18 Thread Angus Leeming
On Wednesday 17 April 2002 8:21 pm, Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > | I'm clearly confused when it comes to "const" and member pointers. > | > | See the little code snippet below. If I compile it, I get the error: > | > | cxx: Error: trial.C, line 23: (that

Re: C++ question

2002-04-17 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | I'm clearly confused when it comes to "const" and member pointers. > | See the little code snippet below. If I compile it, I get the error: > | cxx: Error: trial.C, line 23: (that is, in the const_method) | the object has type qualifiers that are not co

Re: C++ question

2002-03-13 Thread Angus Leeming
On Wednesday 13 March 2002 6:08 pm, Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > > | If I have a map some_map, can I create a vector of the keys also, > | vector ref_vec? I can create a vector ptr_vec. > > > | I'm thinking of my Bibtex data base of course. > > You c

Re: C++ question

2002-03-13 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | If I have a map some_map, can I create a vector of the keys also, | vector ref_vec? I can create a vector ptr_vec. > | I'm thinking of my Bibtex data base of course. You cannot "reset" an reference; string a("Hello There!"); string & b = a; string c(

Re: C++ question

2001-12-12 Thread Angus Leeming
On Wednesday 12 December 2001 5:37 pm, Andre Poenitz wrote: > On Wed, Dec 12, 2001 at 03:50:46PM +, Angus Leeming wrote: > > Sorry for the off-topic question but: > > > > What is the correct way to empty a stringstream to use it again? Currently, > > I'm using ss.str(string()) but I'm sure

Re: C++ question

2001-12-12 Thread Andre Poenitz
On Wed, Dec 12, 2001 at 03:50:46PM +, Angus Leeming wrote: > Sorry for the off-topic question but: > > What is the correct way to empty a stringstream to use it again? Currently, > I'm using ss.str(string()) but I'm sure there must be a better way... Don't do that. Use a new stream. I'll ne

Re: C++ question

2001-12-12 Thread Angus Leeming
On Wednesday 12 December 2001 3:52 pm, Lars Gullik Bjønnes wrote: > I do not think there is better way... Thank you. A

Re: C++ question

2001-05-09 Thread Angus Leeming
Perfect. Thank you. A On Wednesday 09 May 2001 11:31, John Levon wrote: > On Wed, 9 May 2001, Angus Leeming wrote: > > > This one dies with > > > > cxx: Error: #79 expected a type specifier > > typedef MenuList::const_iterator const_iterator; > ^ > > try adding "typen

Re: C++ question

2001-03-22 Thread Dekel Tsur
On Thu, Mar 22, 2001 at 02:43:31PM +0100, Lars Gullik Bjønnes wrote: > | http://lambda.cs.utu.fi/ > I don't want to begin using the LL lib before it is accepted into > Boost. And the list of supported compilers (http://lambda.cs.utu.fi/supported_compilers.html) contains only gcc 2.95 ...

Re: C++ question

2001-03-22 Thread Andre Poenitz
> In other words, using directly the lambda-expression > $\lambda x.-sin(x*pi/180)$ > > It works with simple expressions, functions, functors, member functions, > has control flow, exceptions handling ... Nice, isn't it? ;-) Andre' -- André Pönitz [EMA

Re: C++ question

2001-03-22 Thread Andre Poenitz
> Where can I get this ? Freshmeat turns up blank. A snippet from the main header file: // -- ll.hpp -- Lambda Library // - // Copyright (C) 1999, 2000 Jaakko Järvi ([EMAIL PROTECTED]) // // Permission to copy, use, sell and distribute this software i

Re: C++ question

2001-03-22 Thread Lars Gullik Bjønnes
Yves Bastide <[EMAIL PROTECTED]> writes: | > Where can I get this ? Freshmeat turns up blank. | > | http://lambda.cs.utu.fi/ | | I didn't know either, but jumped on it the instant I read André's message. | Seems it can make all those pesky five-lines functors a bad memory. I don't want to begi

Re: C++ question

2001-03-22 Thread John Levon
On Thu, 22 Mar 2001, Yves Bastide wrote: > On Thu, Mar 22, 2001 at 12:40:03PM +, John Levon wrote: > > On Wed, 21 Mar 2001, Andre Poenitz wrote: > > > > > I admit that functors in the current Standard Lirary are clumsy to use. > > > If LyX would use them on a regular base I'd suggest to use

Re: C++ question

2001-03-22 Thread Yves Bastide
On Thu, Mar 22, 2001 at 12:40:03PM +, John Levon wrote: > On Wed, 21 Mar 2001, Andre Poenitz wrote: > > > I admit that functors in the current Standard Lirary are clumsy to use. > > If LyX would use them on a regular base I'd suggest to use the 'Lambda > > Library' which makes those things mu

Re: C++ question

2001-03-22 Thread Jean-Marc Lasgouttes
> "John" == John Levon <[EMAIL PROTECTED]> writes: John> Oh, and JMarc, is the comment about gcc 2.8.1 in John> support/debugstream still applicable now ? Now that we use namespaces all over, support for gcc 2.8.1 should be considered as dead. JMarc

Re: C++ question

2001-03-22 Thread John Levon
On Wed, 21 Mar 2001, Andre Poenitz wrote: > I admit that functors in the current Standard Lirary are clumsy to use. > If LyX would use them on a regular base I'd suggest to use the 'Lambda > Library' which makes those things much easier to write and more pleasing to > the eye, but for the occasio

Re: C++ question

2001-03-21 Thread Lars Gullik Bjønnes
Andre Poenitz <[EMAIL PROTECTED]> writes: | > | vector names; | > | std::copy(family.begin(), family.end(), | > | back_inserter(push_back_first(names))); | > | > And this will work equally well with any container that implements | > push_back not just vectors or

Re: C++ question

2001-03-20 Thread Andre Poenitz
> | vector names; > | std::copy(family.begin(), family.end(), > | back_inserter(push_back_first(names))); > > And this will work equally well with any container that implements > push_back not just vectors or constainers that implement operator[] And the transfo

Re: C++ question

2001-03-20 Thread Andre Poenitz
> Many thanks to you both, Lars and André. I'm still pretty ignorant when > it comes to functors. I wrote a template function to achieve my goals. Is > your way better, or is it just a matter of style? You copy the whole vector once more than either Lars's or my solution. Moreover, access to a ve

Re: C++ question

2001-03-20 Thread Lars Gullik Bjønnes
[EMAIL PROTECTED] (Lars Gullik Bjønnes) writes: | vector names; | std::copy(family.begin(), family.end(), | back_inserter(push_back_first(names))); And this will work equally well with any container that implements push_back not just vectors or constainers that

Re: C++ question

2001-03-20 Thread Lars Gullik Bjønnes
Dekel Tsur <[EMAIL PROTECTED]> writes: | On Tue, Mar 20, 2001 at 06:18:11PM +0100, Lars Gullik Bjønnes wrote: | > Depends _I_ thing my version is better than your since it operates | > on iterators, so I don't have to copy the whole vector. | > This is also why I thing the back_inserter varia

Re: C++ question

2001-03-20 Thread Dekel Tsur
On Tue, Mar 20, 2001 at 06:18:11PM +0100, Lars Gullik Bjønnes wrote: > Depends _I_ thing my version is better than your since it operates > on iterators, so I don't have to copy the whole vector. > This is also why I thing the back_inserter variant is better than the > transform solution. But

Re: C++ question

2001-03-20 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Excellent. I knew there would be a good reason. Time to dig out a C++ book | again, I think. If I may suggest one... Exceptional C++, Herb Sutter. Mainly on exception safety and how this impacts all design. Also some about lookup rules, and a lot of

Re: C++ question

2001-03-20 Thread Angus Leeming
Excellent. I knew there would be a good reason. Time to dig out a C++ book again, I think. Many thanks, Angus On Tuesday 20 March 2001 17:18, Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > > | Many thanks to you both, Lars and André. I'm still pretty ignorant when

Re: C++ question

2001-03-20 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Many thanks to you both, Lars and André. I'm still pretty ignorant when it | comes to functors. I wrote a template function to achieve my goals. Is | your way better, or is it just a matter of style? Depends _I_ thing my version is better than yo

Re: C++ question

2001-03-20 Thread Angus Leeming
Many thanks to you both, Lars and André. I'm still pretty ignorant when it comes to functors. I wrote a template function to achieve my goals. Is your way better, or is it just a matter of style? A template std::vector const getFirst(std::vector > const & pairVec) { typedef std::vecto

Re: C++ question

2001-03-20 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Please excuse the dumm question, but is their a simple way to extract the | vector from a vector > ? | | Eg, I have: | typedef std::pair FamilyPair; | std::vector family; | | And I'd like to do this: | std::vector names = family.fir

Re: C++ question

2001-03-20 Thread Andre Poenitz
> Please excuse the dumm question, but is their a simple way to extract the > vector from a vector > ? Depends on what you consider 'simple': struct firster { string const & operator()(FamilyPair const & p) { return p.first; } }; { ... std::vector names(family.size()); std::transform(f

Re: C++ question

2001-01-12 Thread Lars Gullik Bjønnes
Dekel Tsur <[EMAIL PROTECTED]> writes: | On Fri, Jan 12, 2001 at 03:51:42PM +0100, Lars Gullik Bjønnes wrote: | > | Basically gcc 2.8.x, egcs 1.0.x. | > | > Yes, but is this namespaces in general or "only" std::? | | My compiler (egcs-1.0.3) fails | | x.C:4: sorry, not implemented: namespace |

Re: C++ question

2001-01-12 Thread Dekel Tsur
On Fri, Jan 12, 2001 at 03:51:42PM +0100, Lars Gullik Bj&resh;nnes wrote: > | Basically gcc 2.8.x, egcs 1.0.x. > > Yes, but is this namespaces in general or "only" std::? My compiler (egcs-1.0.3) fails x.C:4: sorry, not implemented: namespace x.C: In function int main()': x.C:11: Test' undeclar

Re: C++ question

2001-01-12 Thread Jean-Marc Lasgouttes
> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes: Lars> Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes: | Lars> > "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes: | | Lars> Lars> I'd realy like to use namespaces. | | Lars> What compilers Lars> have problems? | | Basica

Re: C++ question

2001-01-12 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes: | > "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes: | | Lars> I'd realy like to use namespaces. | | Lars> What compilers have problems? | | Basically gcc 2.8.x, egcs 1.0.x. Yes, but is this namespaces in general or "only" std::?

Re: C++ question

2001-01-12 Thread Jean-Marc Lasgouttes
> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes: Lars> I'd realy like to use namespaces. Lars> What compilers have problems? Basically gcc 2.8.x, egcs 1.0.x. JMarc

Re: C++ question

2001-01-12 Thread Angus Leeming
On Friday 12 January 2001 14:25, Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > | I've managed to create a GUI-I ControlCitation class that stores a > | pointer to a ButtonController abstract base class. However, in my xforms > | specific FormViewCitation class, I need to

Re: C++ question

2001-01-12 Thread Lars Gullik Bjønnes
John Levon <[EMAIL PROTECTED]> writes: | On Fri, 12 Jan 2001, Angus Leeming wrote: | | > I've managed to create a GUI-I ControlCitation class that stores a pointer to | > a ButtonController abstract base class. However, in my xforms specific | > FormViewCitation class, I need to access FormBut

Re: C++ question

2001-01-12 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | I've managed to create a GUI-I ControlCitation class that stores a pointer to | a ButtonController abstract base class. However, in my xforms specific | FormViewCitation class, I need to access FormButtonController specific | functions and must, ther

Re: C++ question

2001-01-12 Thread John Levon
On Fri, 12 Jan 2001, Angus Leeming wrote: > I've managed to create a GUI-I ControlCitation class that stores a pointer to > a ButtonController abstract base class. However, in my xforms specific > FormViewCitation class, I need to access FormButtonController specific > functions and must, ther

Re: C++ question

2000-03-09 Thread Angus Leeming
Problem solved. Forgot to create derived class destructor (Missing {}, see below). Angus #include "FormBase.h" class FormCredits : public FormBase { public: FormCredits(LyXFunc * c, Dialogs * d, Signal0 & signal) : FormBase( c, d, signal ) {} ~FormCredits() {}; privat