[all-commits] [llvm/llvm-project] 9ebc83: [ADT] Add SFINAE guards to unique_function constru...

Sam McCall via All-commits all-commits at lists.llvm.org
Wed Feb 17 01:36:40 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9ebc837f555249759c538338ffdbf7463e1b6a77
      https://github.com/llvm/llvm-project/commit/9ebc837f555249759c538338ffdbf7463e1b6a77
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2021-02-17 (Wed, 17 Feb 2021)

  Changed paths:
    M llvm/include/llvm/ADT/FunctionExtras.h
    M llvm/unittests/ADT/FunctionExtrasTest.cpp

  Log Message:
  -----------
  [ADT] Add SFINAE guards to unique_function constructor.

We can't construct a working unique_function from an object that's not callable
with the right types, so don't allow deduction to succeed.
This avoids some ambiguous conversion cases, e.g. allowing to overload
on different unique_function types, and to conversion operators to
unique_function.

std::function and the any_invocable proposal have these.
This was added to llvm::function_ref in D88901 and followups

Differential Revision: https://reviews.llvm.org/D96794




More information about the All-commits mailing list