Return-Path: Delivered-To: apmail-stdcxx-dev-archive@www.apache.org Received: (qmail 70539 invoked from network); 26 Jun 2008 15:45:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 26 Jun 2008 15:45:34 -0000 Received: (qmail 2783 invoked by uid 500); 26 Jun 2008 15:45:35 -0000 Delivered-To: apmail-stdcxx-dev-archive@stdcxx.apache.org Received: (qmail 2766 invoked by uid 500); 26 Jun 2008 15:45:35 -0000 Mailing-List: contact dev-help@stdcxx.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@stdcxx.apache.org Delivered-To: mailing list dev@stdcxx.apache.org Received: (qmail 2755 invoked by uid 99); 26 Jun 2008 15:45:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jun 2008 08:45:35 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of msebor@gmail.com designates 64.233.184.226 as permitted sender) Received: from [64.233.184.226] (HELO wr-out-0506.google.com) (64.233.184.226) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jun 2008 15:44:44 +0000 Received: by wr-out-0506.google.com with SMTP id c8so44453wra.27 for ; Thu, 26 Jun 2008 08:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :organization:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding:sender; bh=BzaGZwVp/MnyZxC9YyqFXqX+VxOzbdRGUGHtU5+ENSY=; b=hGgBxI/4W5HcsAla1mT5BLM7/VGqqadFOH0vn2ViCWOv8+1rU6nvK98qMUXpD9/NhK 6rdoQ6d03kpxtwq1rsZU4eMq1JB2Y+TFXXeD9yk+ZO3B3br2aBuXTQBwxUvf7fvS8e/i aq90ZMQKuR7iNj0k4WEFtwV6Z1N0xsvm/LU+A= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:organization:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding:sender; b=a4hwr9kksGpt7jdgRqyAhl9JMXYoJfkqy/YOjkAK5T+Y+fLZtilUbo6+gGqX6aBU0f rVeDnC9ZCBYVsaOeogX+uKxFrRTsM0Ptyg3AxeEQ3CtBlf7Qq7pb1xpkwE5TpcwljokY WilImeRQztAVu9rJdg108cSYbsygWjEk7Q3BA= Received: by 10.90.116.9 with SMTP id o9mr52937agc.49.1214495103101; Thu, 26 Jun 2008 08:45:03 -0700 (PDT) Received: from localhost.localdomain ( [71.229.200.170]) by mx.google.com with ESMTPS id e76sm220455hse.18.2008.06.26.08.45.01 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 26 Jun 2008 08:45:02 -0700 (PDT) Message-ID: <4863B97C.7050304@roguewave.com> Date: Thu, 26 Jun 2008 09:45:00 -0600 From: Martin Sebor Organization: Rogue Wave Software, Inc. User-Agent: Thunderbird 2.0.0.14 (X11/20080501) MIME-Version: 1.0 To: dev@stdcxx.apache.org Subject: Re: __rw_and (Was RE: Some internal aliases for __rw_integral_constant?) References: <48617F0F.2020100@roguewave.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: Martin Sebor X-Virus-Checked: Checked by ClamAV on apache.org Eric Lemings wrote: > [...] > Okay, another proposal for inclusion though this particular utility > may be a stretch unless you understand variadic templates very well. Can you show what the code looks like w/o __rw_and for comparison? In general, an important design principle behind stdcxx is efficiency, both in time and in space. And in terms of time, both compilation as well runtime efficiency is important. In contrast to the ordinary kind, template metaprogramming tends to increase compilation times much more noticeably. In C++ 0x a good amount metaprogramming code is dictated by the standard already but as a rule we need exercise restraint when introducing templatized helper code, especially when template recursion is involved. Martin PS As an aside, concepts should obviate the need for __rw_and and similar metaprogramming tricks. > > template > struct __rw_and; > > template <> > struct __rw_and<>: std::true_type {}; > > template > struct __rw_and<_Bool0, _BoolN...> > : _RWSTD_BOOL_CONST (_Bool0 && __rw_and<_BoolN...>::value) > {}; > > For example: > > template > struct tuple { > > template > struct __rw_is_compat > : __rw_and _TypesU>::value...> { > > static_assert (sizeof... (_TypesT) == sizeof... > (_TypesU), > "tuple sizes must be equal"); > }; > > }; > > Here are some quick tests that I tried out on it: > > typedef tuple T1; > std::cout << T1::__rw_is_compat::value > << std::endl; > > std::cout << T1::__rw_is_compat long>::value > << std::endl; > > std::cout << T1::__rw_is_compat::value > << std::endl; > > std::cout << T1::__rw_is_compat::value > << std::endl; > > // fires the static assertion > //std::cout << T1::__rw_is_compat::value > //<< std::endl; > > Might just save that one for later but worth posting at least. :) > > Brad.