220 30692 <CAFk2RUYsJCALYoEWnirrgrmrOGfNZR82=aW8JhKSXNos8Q8tiw@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Ville Voutilainen <ville.voutilainen@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: template template aliases?
Date: Mon, 30 Jan 2017 19:29:02 +0200
Lines: 52
Approved: news@gmane.org
Message-ID: <CAFk2RUYsJCALYoEWnirrgrmrOGfNZR82=aW8JhKSXNos8Q8tiw@mail.gmail.com>
References: <CAAvM5f8JOZqCzNwB3iKqD_wBACVL_j4EA95MbWR_yr1M=R7HbA@mail.gmail.com>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
X-Trace: blaine.gmane.org 1485797344 14532 195.159.176.226 (30 Jan 2017 17:29:04 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 30 Jan 2017 17:29:04 +0000 (UTC)
Cc: Richard Smith <richardsmith@google.com>
To: "ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC5JHI7A7ALRBXXPXXCAKGQEPJSFKOA@isocpp.org Mon Jan 30 18:29:00 2017
Return-path: <std-proposals+bncBC5JHI7A7ALRBXXPXXCAKGQEPJSFKOA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yb0-f197.google.com ([209.85.213.197])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC5JHI7A7ALRBXXPXXCAKGQEPJSFKOA@isocpp.org>)
	id 1cYFlC-0003Y0-Jj
	for gclcip-std-proposals@m.gmane.org; Mon, 30 Jan 2017 18:28:58 +0100
Original-Received: by mail-yb0-f197.google.com with SMTP id d197sf17409517ybh.4
        for <gclcip-std-proposals@m.gmane.org>; Mon, 30 Jan 2017 09:29:04 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:in-reply-to:references:from:date:message-id:subject:to
         :cc:x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=++2LoJVSVjnHS+/V2VzR2fRqHxPRszBN7hwPm/dc5c4=;
        b=I2M/LAq+c2LW3khqU9qxyFQwfW3mR37JUu1uXCdk8KDPPLjaBAeDRhTsC5zCye2wjn
         OaAnAC5g54otDD55K/MR/Cl7Bxty44FL9hh/xsQhyw7nlwDAt3dNmrnUiMhis9/HIabq
         kTPLRDZlxQS25IBzLPMyOWqf2TL1NzcJQxYpo3vpPGDl2s6z3RjUWEkbYwA7e3FSeLt8
         Mfwuj9cikHZr52TK+v91M5tHTsrGSgaBNSjEWgNvxbtFnGJt33G4Z4QTZYgsEZA1vDic
         rmQfDBTjyrCVh/0nAuK2vUJhAzR91XjMei/TNwybIbbisQHQ8tOnQKsSiydnikzJAOI/
         BOVQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:in-reply-to:references:from:date
         :message-id:subject:to:cc:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=++2LoJVSVjnHS+/V2VzR2fRqHxPRszBN7hwPm/dc5c4=;
        b=G3Y72bqSFJp2CgiWYeIMn8VzVcQdRpipDtYKYt22EVbMKaajkk0zVPq+xRca/rjjzB
         cfoCxzrxUeh5Om9kc2Lt7hBJ6aYvzEhA9x2r+zLXUHrsPlxuequ3+txo9YQQuZQNcTuV
         92wUJypLYSI8QIoqOunpVqSZ8Y5l8lgUDUQ2HdfhEAXIdRo+zOIOqEaPKPlblqoT4WlV
         yHdeI4F5VyHyagF9CmpbvljmPLC+0zkbdIYSxdbfQ3bIoh+U4IRCXs1zSow0GeNanzmV
         rDYJubJ1Yc482MngR3j4AEDeipe4ISIZLUqLAtzz/rrsh/1XBgF7QWI6j+heOm+RQovs
         fxHA==
X-Gm-Message-State: AIkVDXLcTfu68VZBYH1oA3iNutI8wTNfDkjEj6D3NrBd4G440KTgoXaPru+sHgyU8+IeLw==
X-Received: by 10.129.78.79 with SMTP id c76mr6639612ywb.152.1485797343520;
        Mon, 30 Jan 2017 09:29:03 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.4.71 with SMTP id 65ls7645353otc.33.gmail; Mon, 30 Jan
 2017 09:29:02 -0800 (PST)
X-Received: by 10.157.30.231 with SMTP id n94mr12050002otn.248.1485797342793;
        Mon, 30 Jan 2017 09:29:02 -0800 (PST)
Original-Received: from mail-ot0-x22f.google.com (mail-ot0-x22f.google.com. [2607:f8b0:4003:c0f::22f])
        by mx.google.com with ESMTPS id b133si5687410oii.47.2017.01.30.09.29.02
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 30 Jan 2017 09:29:02 -0800 (PST)
Received-SPF: pass (google.com: domain of ville.voutilainen@gmail.com designates 2607:f8b0:4003:c0f::22f as permitted sender) client-ip=2607:f8b0:4003:c0f::22f;
Original-Received: by mail-ot0-x22f.google.com with SMTP id f9so247378751otd.1
        for <std-proposals@isocpp.org>; Mon, 30 Jan 2017 09:29:02 -0800 (PST)
X-Received: by 10.157.0.38 with SMTP id 35mr11955606ota.227.1485797342592;
 Mon, 30 Jan 2017 09:29:02 -0800 (PST)
Original-Received: by 10.157.5.225 with HTTP; Mon, 30 Jan 2017 09:29:02 -0800 (PST)
In-Reply-To: <CAAvM5f8JOZqCzNwB3iKqD_wBACVL_j4EA95MbWR_yr1M=R7HbA@mail.gmail.com>
X-Original-Sender: ville.voutilainen@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 ville.voutilainen@gmail.com designates 2607:f8b0:4003:c0f::22f as permitted
 sender) smtp.mailfrom=ville.voutilainen@gmail.com;       dmarc=pass (p=NONE
 sp=NONE dis=NONE) header.from=gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:30692
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/30692>

On 30 January 2017 at 19:24, Eric Niebler <eric.niebler@gmail.com> wrote:
> Crazy thought.
>
> Why not permit template template aliases?
>
>   template <class A>
>   template <class B>
>   using Foo = pair<A, B>;
>
> Foo<A> is a unary template such that Foo<A><B> is pair<A,B>.
>
> Why?
>
> Higher order template metaprogramming sometimes requires passing a template
> to a template. For example:
>
>   // with C++17 fold expressions
>   template <template <class Ts> class Pred, class...Ts>
>   constexpr bool all_of = (... && Pred<Ts>::value);
>
>   static_assert(all_of<std::is_scalar, int, short, float>);
>
> Q: How would you use all_of to check that all types in a pack are
> convertible to bool?
> A: With a "bind"-like template template alias:
>
>   template <template<class...> class Fn, class...As>
>   template <class...Bs>
>   using bind_back = Fn<Bs..., As...>;
>
>   template <template<class...> class Fn>
>   template <class T>
>   using unary = Fn<T>;
>
>   static_assert(all_of<unary<bind_back<std::is_convertible, bool>>, int,
> short, float>);
>
> What would this language feature break?


It mixes the water about whether an alias is a template (currently it
isn't, it's replaced immediately and
cannot be specialized) or not. That doesn't mean the whole idea is
nuts, but it's probably
something to think about.

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFk2RUYsJCALYoEWnirrgrmrOGfNZR82%3DaW8JhKSXNos8Q8tiw%40mail.gmail.com.

.
