From: Ivan Levashew <octagram@bluebottle.com>
Subject: Re: numbers as 'generics' parameters
Date: Mon, 19 May 2008 12:16:49 +0700
Date: 2008-05-19T12:16:49+07:00 [thread overview]
Message-ID: <g0r1g1$kpv$1@registered.motzarella.org> (raw)
In-Reply-To:
Maciej Sobczak пишет:
> template <size_t N>
> void foo(const fixed_size_string<N> & s1,
> const fixed_size_string<N> & s2)
AFAIK this will prevent N from being unknown at compile-time. Or anyway
I don't know how will C++ handle undefined N. AFAIK C++, there could be
"foo <3> (const fixed_size_string<3> &, const fixed_size_string<3> &)",
"foo <4> (const fixed_size_string<4> &, const fixed_size_string<4> &)"
mangled names. I'm not sure if C++ is able to convert dynamic template
parameters to subroutine parameters. This could be probably solved by
replacing "size_t N" with "const size_t& N", but AFAIK it'll render the
automatic being demonstrated here invalid since
fixed_size_string<3> s = "Ada";
fixed_size_string<3> t = "C++";
are likely to use different "size_t&" references, aren't they?
I think this particular case is a dead-end way of promoting either Ada
over C++ or C++ over Ada.
--
If you want to get to the top, you have to start at the bottom
next prev parent reply other threads:[~2008-05-19 5:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-16 17:26 numbers as 'generics' parameters jhc0033
2008-05-16 17:55 ` Adam Beneschan
2008-05-16 19:12 ` John B. Matthews
2008-05-16 18:34 ` jimmaureenrogers
2008-05-16 18:57 ` Gautier
2008-05-16 20:52 ` Maciej Sobczak
2008-05-16 23:09 ` Peter C. Chapin
2008-05-17 7:47 ` Dmitry A. Kazakov
2008-05-17 16:29 ` Maciej Sobczak
2008-05-17 17:34 ` Dmitry A. Kazakov
2008-05-18 13:58 ` Maciej Sobczak
2008-05-18 14:52 ` Dmitry A. Kazakov
2008-05-18 20:37 ` Maciej Sobczak
2008-05-19 9:02 ` Dmitry A. Kazakov
2008-05-19 5:16 ` Ivan Levashew [this message]
2008-05-19 8:26 ` Maciej Sobczak
2008-05-16 20:22 ` Jeffrey R. Carter
2008-05-21 15:32 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox