220 30694 <CANu6V4U0GDA5Zoi7Ri-fvBp+eM05gXYawQghu69MGTkdS3=91Q@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: "'Johannes Schaub' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: template template aliases?
Date: Mon, 30 Jan 2017 18:38:53 +0100
Lines: 62
Approved: news@gmane.org
Message-ID: <CANu6V4U0GDA5Zoi7Ri-fvBp+eM05gXYawQghu69MGTkdS3=91Q@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 1485797935 27200 195.159.176.226 (30 Jan 2017 17:38:55 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 30 Jan 2017 17:38:55 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCQPNCEZSQNBBLXUXXCAKGQECUTS6YY@isocpp.org Mon Jan 30 18:38:51 2017
Return-path: <std-proposals+bncBCQPNCEZSQNBBLXUXXCAKGQECUTS6YY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yb0-f200.google.com ([209.85.213.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCQPNCEZSQNBBLXUXXCAKGQECUTS6YY@isocpp.org>)
	id 1cYFuk-0006qO-8l
	for gclcip-std-proposals@m.gmane.org; Mon, 30 Jan 2017 18:38:50 +0100
Original-Received: by mail-yb0-f200.google.com with SMTP id d197sf17884485ybh.4
        for <gclcip-std-proposals@m.gmane.org>; Mon, 30 Jan 2017 09:38:55 -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
         :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=QD5fu5bS0XHs/Lv47qx7M2OOiQe73gARF6PYqxSf1Fs=;
        b=m3v31YehzZAxQfuz3/7A2Cc9ffpcVl6SXfBTcRFmvd9Tyoy3IADQTWAM4uJ1ZUfaLa
         VTAio42E2sPM9iUYveztHIfZcFKiaxpqyWaPMny6iWBbiJ9KUjMM5mhBFdhgjNO6PJG/
         AgyXsBagN1iY88bnzVbONs+/xi5j32lEKZjUj58sdK9gr6xDPb79TLmu8O8+EJKz/7y4
         bjiNIuL+hT6oukH6frjvDM3Czlrqw+aP+tNHD6NW//epNhXNWZPpASKoIqvzprNR7IS0
         ZRD9UdEwy68kpBBLJX2vHu0NOak/ThE5UqXhu0l3Um4itvjJwaPRvZRC1LmA+7L3UtnF
         fWVQ==
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: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=QD5fu5bS0XHs/Lv47qx7M2OOiQe73gARF6PYqxSf1Fs=;
        b=aJuLmxgPhjEE3JU33ZxXwxyC00jsWOS95F7iWDZKz7fOOqsgHO5bh3vhV2uPd59UFg
         iIDkEIUQjuVK3GpeQvcClvid1bWorvO0er+w6p1LWxHyVggOAJfS6Z3Xd+9YnZnfy1nH
         RhJZ0ADWAV4osPunjQlnrHh8KfwwenW3B7M4Foos1E/fcMtcrAQjs7W+2+UC5Apaytd5
         eLDpPsK4xbaBgRicg7GPAjzAe2b/saRyYbTSiYcUBVqgHa+Tfzj5iksaJqXghDWw4Y8R
         3krd1fFvp9mhsC/cU2GNwqvOEDF9USbQB1Ozr9E3UCFbgID+O8FXjK5pdDNmPqm60U0m
         2Oqw==
X-Gm-Message-State: AIkVDXLMlyet/X1D/1JcC3qmNS+tVX8WwA9d9R7+441WepjMSSIwusYRPYpkLjC32X4+/g==
X-Received: by 10.13.204.75 with SMTP id o72mr6549807ywd.91.1485797935381;
        Mon, 30 Jan 2017 09:38:55 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.9.200 with SMTP id 8ls6860282otz.48.gmail; Mon, 30 Jan
 2017 09:38:54 -0800 (PST)
X-Received: by 10.157.37.118 with SMTP id j51mr10103646otd.47.1485797934435;
        Mon, 30 Jan 2017 09:38:54 -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 u21si5698919otf.65.2017.01.30.09.38.54
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Mon, 30 Jan 2017 09:38:54 -0800 (PST)
Received-SPF: pass (google.com: domain of schaub.johannes@googlemail.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 32so89041814oth.3
        for <std-proposals@isocpp.org>; Mon, 30 Jan 2017 09:38:54 -0800 (PST)
X-Received: by 10.157.19.117 with SMTP id q50mr10705193otq.54.1485797933958;
 Mon, 30 Jan 2017 09:38:53 -0800 (PST)
Original-Received: by 10.74.60.23 with HTTP; Mon, 30 Jan 2017 09:38:53 -0800 (PST)
In-Reply-To: <CAAvM5f8JOZqCzNwB3iKqD_wBACVL_j4EA95MbWR_yr1M=R7HbA@mail.gmail.com>
X-Original-Sender: schaub.johannes@googlemail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@googlemail.com;       spf=pass (google.com: domain of
 schaub.johannes@googlemail.com designates 2607:f8b0:4003:c0f::22f as
 permitted sender) smtp.mailfrom=schaub.johannes@googlemail.com;
       dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com
X-Original-From: Johannes Schaub <schaub.johannes@googlemail.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:30694
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/30694>

2017-01-30 18:24 GMT+01:00 Eric Niebler <eric.niebler@gmail.com>:
> 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?
>

Some note about the syntax. I think you need to extend it so that
"template" can be put after the angle brackets aswell?

    template<typename T>
    struct A { template<typename A> template<typename B> using X =
void (A::*)(B); };

    template<typename T>
    void f() {
       typename T::template X<string> template<size_t> p = &string::resize;
    }

    int main() { f<A>(); }

Note the second "template" disambiguator.

-- 
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/CANu6V4U0GDA5Zoi7Ri-fvBp%2BeM05gXYawQghu69MGTkdS3%3D91Q%40mail.gmail.com.

.
