Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #9933

Re: block allocation

From Philipp Kraus <philipp.kraus@flashpixx.de>
Newsgroups comp.lang.c++
Subject Re: block allocation
Date 2011-09-08 17:52 +0200
Organization 1&1 Internet AG
Message-ID <j4aocl$i0j$1@online.de> (permalink)
References <j4ahk9$ca9$1@online.de> <3ebd2cd2-a517-459d-9f5b-c288ef172ef7@l4g2000vbz.googlegroups.com> <j4am6n$g57$1@online.de> <op.v1hx3tqo2juju3@ajwin7>

Show all headers | View raw


On 2011-09-08 17:46:31 +0200, Asger-P said:

> Hi Philipp
> 
> On the: 08. of september-2011 At: 17:15 Philipp Kraus wrote:
> 
>> I can't call my constructor, I need call a method named "clone()". I 
>> create a call like:
>> 
>> std::vector<myclass> vec(p_size);
>> for(std::size_t i=0; i < p_size; ++i)
>> vec.psuh_back( myclass.clone() );
> 
> Others have much more knowledge about this then I, but I
> just want to say that in order to use std::vector efficiently
> You need to set up a copy constructor and the operator =
> You can then call Your Clone function from those.
> If You dont do it then the compiler will do it for You and it
> will probably not have the same effect as if Clone was called.
> 
> P.s. how does Your clone function look exactly ?

Sorry, I can't use a copy-constructor, because the clone function must 
create some special unique data and I need a "default copy-constructor" 
also.
So I would like to create both methods.

Phil

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

block allocation Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-08 15:57 +0200
  Re: block allocation Goran <goran.pusic@gmail.com> - 2011-09-08 07:32 -0700
  Re: block allocation Asger-P <junk@asger-p.dk> - 2011-09-08 16:42 +0200
  Re: block allocation Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-08 16:50 +0200
  Re: block allocation Noah Roberts <roberts.noah@gmail.com> - 2011-09-08 08:09 -0700
    Re: block allocation Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-08 17:15 +0200
      Re: block allocation Victor Bazarov <v.bazarov@comcast.invalid> - 2011-09-08 11:27 -0400
      Re: block allocation Asger-P <junk@asger-p.dk> - 2011-09-08 17:46 +0200
        Re: block allocation Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-08 17:52 +0200
          Re: block allocation Asger-P <junk@asger-p.dk> - 2011-09-08 18:35 +0200
            Re: block allocation Philipp Kraus <philipp.kraus@flashpixx.de> - 2011-09-08 20:04 +0200
      Re: block allocation Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-09-08 20:27 +0000

csiph-web