32 #if !defined(__GLIBCXX__) || __GNUC__ >= 5 38 std::is_trivially_constructible<
47 std::is_trivially_assignable<
57 std::is_nothrow_constructible<
66 std::is_nothrow_assignable<
74 auto lambda = [&
x](
int v) {
return x +=
v; };
86 auto const& clambda = lambda;
100 int (*funcptr)(int) = [](
int v) {
return v *
v; };
112 struct OverloadedFunctor {
114 int operator()(
int x) {
119 int operator()(
int x)
const {
124 int operator()(
int x,
int) {
129 int operator()(
int x,
int)
const {
134 int operator()(
int x,
char const*) {
139 int operator()(
int x, std::vector<int>
const&)
const {
143 OverloadedFunctor of;
144 auto const& cof = of;
157 EXPECT_EQ(100 + 3 * 17, variant3(17, 0));
159 EXPECT_EQ(100 + 3 * 17, cvariant3(17, 0));
162 EXPECT_EQ(100 + 4 * 18, variant4(18, 0));
164 EXPECT_EQ(100 + 4 * 18, cvariant4(18, 0));
167 EXPECT_EQ(100 + 5 * 19, variant5(19,
"foo"));
169 EXPECT_EQ(100 + 5 * 19, cvariant5(19,
"foo"));
172 EXPECT_EQ(100 + 6 * 20, variant6(20, {}));
173 EXPECT_EQ(100 + 6 * 20, variant6(20, {1, 2, 3}));
175 EXPECT_EQ(100 + 6 * 20, cvariant6(20, {}));
176 EXPECT_EQ(100 + 6 * 20, cvariant6(20, {1, 2, 3}));
179 EXPECT_EQ(100 + 6 * 21, variant6const(21, {}));
181 EXPECT_EQ(100 + 6 * 21, cvariant6const(21, {}));
190 int (*func)(int, int) = [](
int x,
int y) {
return 10 * x + y; };
197 template <
typename ValueType>
200 template <
typename InputIterator>
203 for (
auto it = begin; it !=
end; ++it) {
217 std::list<int>
s{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
223 fe([&](
int x) { sum +=
x; });
std::atomic< int64_t > sum(0)
#define EXPECT_THROW(statement, expected_exception)
#define EXPECT_EQ(val1, val2)
A reference wrapper for callable objects.
auto begin(TestAdlIterable &instance)
ForEach(InputIterator begin, InputIterator end)
TEST(FunctionRef, Traits)
auto end(TestAdlIterable &instance)
static const char *const value
#define EXPECT_TRUE(condition)
#define EXPECT_FALSE(condition)
void operator()(FunctionRef< void(ValueType)> f) const