Skip to content

Commit 39744f8

Browse files
committed
simplify naming of logical operators
1 parent 8121800 commit 39744f8

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/functional.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
namespace nv {
88

99
// Logical operators
10-
struct LogicalNot { template <typename T> T operator()(T t) const { return !t; } };
11-
struct LogicalAnd { template <typename T> T operator()(T lhs, T rhs) const { return lhs && rhs; } };
12-
struct LogicalOr { template <typename T> T operator()(T lhs, T rhs) const { return lhs || rhs; } };
10+
struct Not { template <typename T> T operator()(T t) const { return !t; } };
11+
struct And { template <typename T> T operator()(T lhs, T rhs) const { return lhs && rhs; } };
12+
struct Or { template <typename T> T operator()(T lhs, T rhs) const { return lhs || rhs; } };
1313

1414
// unary ops, which are both: (1) a tag which represents the operation and (2) the implementation of that operation
1515
struct Identity { template <typename T> T operator()(T t) const { return t; } };

test/test_functional.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33

44
namespace {
55

6-
TEST(functional, logical_not)
6+
TEST(functional, not)
77
{
8-
const auto f = nv::LogicalNot{};
8+
const auto f = nv::Not{};
99
EXPECT_EQ(f(false), true);
1010
}
1111

12-
TEST(functional, logical_and)
12+
TEST(functional, and)
1313
{
14-
const auto f = nv::LogicalAnd{};
14+
const auto f = nv::And{};
1515
EXPECT_EQ(f(false, true), false);
1616
}
1717

18-
TEST(functional, logical_or)
18+
TEST(functional, or)
1919
{
20-
const auto f = nv::LogicalOr{};
20+
const auto f = nv::Or{};
2121
EXPECT_EQ(f(false, true), true);
2222
}
2323

0 commit comments

Comments
 (0)