Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Overloaded function dilemma

Received: by 10.66.81.74 with SMTP id y10mr4079318pax.17.1350401702224;
        Tue, 16 Oct 2012 08:35:02 -0700 (PDT)
Received: by 10.68.125.164 with SMTP id mr4mr3273938pbb.19.1350401702208; Tue,
 16 Oct 2012 08:35:02 -0700 (PDT)
Path: s9ni11397pbb.0!nntp.google.com!kt20no1438109pbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: comp.lang.c++
Date: Tue, 16 Oct 2012 08:35:01 -0700 (PDT)
In-Reply-To: <k5jphl$4g7$1@speranza.aioe.org>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=41.84.116.31; posting-account=GZj8jgoAAADNkFXELDuATyty3fvIETAv
NNTP-Posting-Host: 41.84.116.31
References: <k5j1kk$5hg$1@speranza.aioe.org> <k5jphl$4g7$1@speranza.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <c03a470b-90de-44ca-8f93-8e8e524d33eb@googlegroups.com>
Subject: Re: Overloaded function dilemma
From: Werner <wer...@gmail.com>
Cc: rui.mac...@gmail.com
Injection-Date: Tue, 16 Oct 2012 15:35:02 +0000
Content-Type: text/plain; charset=ISO-8859-1

On Tuesday, October 16, 2012 4:04:42 PM UTC+2, Rui Maciel wrote:

> If you are looking for clever ways to pass a a long list of arguments 
> 
> through a constructor, there are far better ways to pull this off, which 
> 
> don't require that you lose time writing an endless list of constructors for 
> 
> each object.  As a suggestion, consider the following idea:
> 
> 
> 
> - On your main classes (i.e., the ones which you intended to add those 
> 
> variadic templates), you only define three types of constructor: one taking 
> 
> an iterator range, one taking an initializer list, and one taking an object 
> 
> of a class defined specifically to pass parameters.

[snip]

Having an object for specifically passing parameters implies
that for handling new parameter types, the object 
interface requires modification (except when that object
is something like a tuple that takes arbitrary amount of 
arguments/type).

If the class should really be able to handle an arbitrary
number of arguments of varying types, what better
object than tuple in combination with variadic templates
(or using a static named function is also a good idea Imho)?

Kind regards,

Werner