This patch makes the bind placeholders in std::placeholders both (1) const and (2) constexpr (See below). This is technically a breaking change for any code using the placeholders outside of std::bind and depending on them being non-const. However I don't think this will break any real world code. (1) Previously the placeholders were non-const extern globals in all dialects. This patch changes these extern globals to be const in all dialects. Since the cv-qualifiers don't participate in name mangling for globals this is an ABI compatible change. (2) Make the placeholders constexpr in C++11 and beyond. Although LWG 2488 only applies to C++17 I don't see any reason not to backport this change. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@273824 91177308-0d34-0410-b5e6-96231b3b80d8
32 lines
732 B
C++
32 lines
732 B
C++
//===-------------------------- bind.cpp ----------------------------------===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is dual licensed under the MIT and the University of Illinois Open
|
|
// Source Licenses. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#define _LIBCPP_BUILDING_BIND
|
|
#include "functional"
|
|
|
|
_LIBCPP_BEGIN_NAMESPACE_STD
|
|
|
|
namespace placeholders
|
|
{
|
|
|
|
const __ph<1> _1{};
|
|
const __ph<2> _2{};
|
|
const __ph<3> _3{};
|
|
const __ph<4> _4{};
|
|
const __ph<5> _5{};
|
|
const __ph<6> _6{};
|
|
const __ph<7> _7{};
|
|
const __ph<8> _8{};
|
|
const __ph<9> _9{};
|
|
const __ph<10> _10{};
|
|
|
|
} // placeholders
|
|
|
|
_LIBCPP_END_NAMESPACE_STD
|