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


Groups > comp.std.c++ > #472

Re: Request för std::vector and possibly others: minimal initalization

Path csiph.com!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail
From Pedro Lamarão<pedro.lamarao@gmail.com>
Newsgroups comp.std.c++
Subject Re: Request för std::vector and possibly others: minimal initalization
Date Thu, 29 Mar 2012 12:28:07 -0700 (PDT)
Organization http://groups.google.com
Lines 31
Sender std-cpp-request@vandevoorde.com
Approved stephen.clamage@oracle.com
Message-ID <25560658.357.1332969573044.JavaMail.geo-discussion-forums@ynuu12> (permalink)
References <abf103e0-7005-47b4-9888-af946353a525@v22g2000vby.googlegroups.com> <3008757.1215.1332274822853.JavaMail.geo-discussion-forums@pbjv6> <4991d0ff-8c66-41d2-a04d-22a6acce6065@s9g2000pba.googlegroups.com>
NNTP-Posting-Host PL23FLelEKsbZzxxpQ0pctf7rkiu+J5vA+aOm7q+QJk=
Content-Type text/plain; charset=ISO-8859-1
X-Trace news.albasani.net /j/+gaSk25xy6sVX00Tm89GN1+9m8qZNp3a8BrJjYWgBGrQ5i52qKydxJP5+c18MewMH2XS8BMLbcHkQXEss/w==
X-Complaints-To abuse@albasani.net
NNTP-Posting-Date Thu, 29 Mar 2012 19:28:09 +0000 (UTC)
X-Mailer Perl5 Mail::Internet v2.05
X-Submission-Address std-cpp-submit@vandevoorde.com
Cancel-Lock sha1:D4L8L569a7HGXZhU314QnElrxO8=
X-Original-Date Wed, 28 Mar 2012 14:19:32 -0700 (PDT)
Xref csiph.com comp.std.c++:472

Show key headers only | View raw


Em sexta-feira, 23 de março de 2012 21h11min22s UTC-3, Kevin McCarty  escreveu:

>  Case 1)  Interfacing with old (C?) code that will initialize a
>  contiguous block of memory in-place.  One can't always expect that
>  existing code can be rewritten to take a vector and call push_back or
>  emplace_back on it.
>
>  E.g., supposing the existence of something called std::no_initialize
>  (whatever that might be)
>
>  // some old 3rd-party library function; maybe it calls fread()?
>  extern "C" initialize_mem(size_t sz, int * mem);
>
>  vector<int>   ints(42, std::no_initialize);
>  initialize_mem(ints.size(), ints.data());

In the OP's use case, there is a known amount of "results" for which space must be allocated.

And it is desired to have space allocated, but no constructors run on it.

Isn't uninitialized-land where operator new and std::allocator live? Why not go there?

--
  P.


-- 
[ comp.std.c++ is moderated.  To submit articles, try posting with your ]
[ newsreader.  If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]

Back to comp.std.c++ | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Request för std::vector and possibly others: minimal initalization henrikv <henrik.vallgren@stream-space.com> - 2012-03-19 23:35 -0700
  Re: Request för std::vector and possibly others: minimal initalization Francis Glassborow<francis.glassborow@btinternet.com> - 2012-03-21 11:35 -0700
    Re: Request för std::vector and possibly others: minimal initalization henrikv<henrik.vallgren@stream-space.com> - 2012-03-23 17:09 -0700
      Re: Request för std::vector and possibly others: minimal initalization Daniel Krügler <daniel.kruegler@googlemail.com> - 2012-03-24 19:25 -0700
      Re: Request för std::vector and possibly others: minimal initalization Francis Glassborow <francis.glassborow@btinternet.com> - 2012-03-24 19:28 -0700
  Re: Request för std::vector and possibly others: minimal initalization Jason McKesson<jmckesson@gmail.com> - 2012-03-21 11:35 -0700
    Re: Request för std::vector and possibly others: minimal initalization henrikv<henrik.vallgren@stream-space.com> - 2012-03-23 17:10 -0700
      Re: Request för std::vector and possibly others: minimal initalization Jason McKesson<jmckesson@gmail.com> - 2012-03-24 17:55 -0700
      Re: Request for std::vector and possibly others: mi brangdon@cix.compulink.co.uk (Dave Harris) - 2012-03-24 19:24 -0700
      Re: Re: Request för std::vector and possibly others: minimal initalization jgk@panix.com (Joe keane) - 2012-03-27 12:10 -0700
    Re: Request för std::vector and possibly others: minimal initalization Kevin McCarty<kmccarty@gmail.com> - 2012-03-23 17:11 -0700
      Re: Request för std::vector and possibly others:   minimal initalization Miles Bader<miles@gnu.org> - 2012-03-24 17:55 -0700
        Re: Request för std::vector and possibly others: minimal initalization henrikv <henrik.vallgren@stream-space.com> - 2012-03-25 23:14 -0700
      Re: Request för std::vector and possibly others: minimal initalization Jason McKesson <jmckesson@gmail.com> - 2012-03-24 19:27 -0700
      Re: Request för std::vector and possibly others: minimal initalization Pedro Lamarão<pedro.lamarao@gmail.com> - 2012-03-29 12:28 -0700
        Re: Request för std::vector and possibly others: minimal initalization Daniel Krügler <daniel.kruegler@googlemail.com> - 2012-03-29 13:17 -0700

csiph-web