Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2
diff options
context:
space:
mode:
authorMartin Hořeňovský2021-08-13 00:11:22 +0200
committerMartin Hořeňovský2021-08-16 16:22:16 +0200
commit03ce304102829d438a0e3249b86094a6da802dfa (patch)
treed2760c64cd8fdb4bb29629cdac0599bdd9c41957 /src/catch2
parent7040f03b549c4f21d38c842cc2dbb839e3e6ec2a (diff)
downloadcatch3-03ce304102829d438a0e3249b86094a6da802dfa.tar.gz
Add std::move/std::forward replacement macros
Using the `CATCH_MOVE` and `CATCH_FORWARD` macros instead of the `std::move` and `std::forward<T>` utility functions can improve compilation times and debug build's performance, and thus will be preferred going forward.
Diffstat (limited to 'src/catch2')
-rw-r--r--src/catch2/catch_all.hpp1
-rw-r--r--src/catch2/catch_section_info.hpp1
-rw-r--r--src/catch2/internal/catch_move_and_forward.hpp19
3 files changed, 21 insertions, 0 deletions
diff --git a/src/catch2/catch_all.hpp b/src/catch2/catch_all.hpp
index 6b8ecf4e..35bd9741 100644
--- a/src/catch2/catch_all.hpp
+++ b/src/catch2/catch_all.hpp
@@ -72,6 +72,7 @@
#include <catch2/internal/catch_list.hpp>
#include <catch2/internal/catch_message_info.hpp>
#include <catch2/internal/catch_meta.hpp>
+#include <catch2/internal/catch_move_and_forward.hpp>
#include <catch2/internal/catch_noncopyable.hpp>
#include <catch2/internal/catch_option.hpp>
#include <catch2/internal/catch_output_redirect.hpp>
diff --git a/src/catch2/catch_section_info.hpp b/src/catch2/catch_section_info.hpp
index df0732ec..b80d8b92 100644
--- a/src/catch2/catch_section_info.hpp
+++ b/src/catch2/catch_section_info.hpp
@@ -8,6 +8,7 @@
#ifndef CATCH_SECTION_INFO_HPP_INCLUDED
#define CATCH_SECTION_INFO_HPP_INCLUDED
+#include <catch2/internal/catch_move_and_forward.hpp>
#include <catch2/internal/catch_source_line_info.hpp>
#include <catch2/internal/catch_stringref.hpp>
#include <catch2/catch_totals.hpp>
diff --git a/src/catch2/internal/catch_move_and_forward.hpp b/src/catch2/internal/catch_move_and_forward.hpp
new file mode 100644
index 00000000..70520308
--- /dev/null
+++ b/src/catch2/internal/catch_move_and_forward.hpp
@@ -0,0 +1,19 @@
+
+// Copyright Catch2 Authors
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// https://www.boost.org/LICENSE_1_0.txt)
+
+// SPDX-License-Identifier: BSL-1.0
+#ifndef CATCH_MOVE_AND_FORWARD_HPP_INCLUDED
+#define CATCH_MOVE_AND_FORWARD_HPP_INCLUDED
+
+#include <type_traits>
+
+//! TODO: replaces std::move for better performance
+#define CATCH_MOVE(...) static_cast<std::remove_reference_t<decltype(__VA_ARGS__)>&&>(__VA_ARGS__)
+
+#define CATCH_FORWARD(...) static_cast<decltype(__VA_ARGS__)&&>(__VA_ARGS__)
+
+#endif // CATCH_MOVE_AND_FORWARD_HPP_INCLUDED
+ \ No newline at end of file