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


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

Re: dynamic vector as function parameter

From "A" <a@a.a>
Newsgroups comp.lang.c++
Subject Re: dynamic vector as function parameter
Date 2011-09-15 21:45 +0200
Organization B.net Hrvatska d.o.o.
Message-ID <j4tkme$io4$1@gregory.bnet.hr> (permalink)
References <j4t9oo$vj0$1@gregory.bnet.hr> <j4te9t$ji6$1@dont-email.me>

Show all headers | View raw


> There are no drawbacks besides performance, I guess.  Which ones are *you* 
> thinking of?  You're probably aware of the overhead you're going to incur 
> by creating the vector of only one element.  Can't you just call function 
> DEF directly?

DEF function is just a dumb example it is more complex than this. Not to be 
overanalized :)

My main concern here are memory leaks and to check with experts here if this 
is the way to pass it when I want to avoid creating a variable.

The function should accept vector as input but on a few occasions it needs 
just a single parameter and instead of overloading it or using a vector as 
variable I simply want a quick way to pass a parameter into it.

Performance is of no concern here. Thanks for the answer. 

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


Thread

dynamic vector as function parameter "A" <a@a.a> - 2011-09-15 18:38 +0200
  Re: dynamic vector as function parameter Victor Bazarov <v.bazarov@comcast.invalid> - 2011-09-15 13:57 -0400
    Re: dynamic vector as function parameter "A" <a@a.a> - 2011-09-15 21:45 +0200
      Re: dynamic vector as function parameter Paavo Helde <myfirstname@osa.pri.ee> - 2011-09-15 16:28 -0500
        Re: dynamic vector as function parameter "A" <a@a.a> - 2011-09-16 13:49 +0200
      Re: dynamic vector as function parameter Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-09-17 23:48 +0000
        Re: dynamic vector as function parameter "A" <a@a.a> - 2011-09-18 16:37 +0200
          Re: dynamic vector as function parameter Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-09-18 17:37 +0000

csiph-web