cpp-common/bt2s: use a `using` declaration
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 31 Jan 2024 22:37:49 +0000 (17:37 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Mon, 5 Feb 2024 16:46:02 +0000 (11:46 -0500)
This is exactly the purpose of a `using` declaration, to make the symbol
from the `bpstd`/`nonstd` namespace accessible for unqualified lookup as
if declared in the `bt2s` namespace.

The code is much simpler.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I8348f409a463b85f5b2ed1f1fd8f61adb404a6d9
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11727
Tested-by: jenkins <jenkins@lttng.org>
CI-Build: Simon Marchi <simon.marchi@efficios.com>

src/cpp-common/bt2s/optional.hpp
src/cpp-common/bt2s/string-view.hpp

index 96d003df457c25035bbca27d377e4c4c563f9b06..13f121c05a631e5f86257c551de6ea1bb77ba3ad 100644 (file)
 
 namespace bt2s {
 
-template <typename T>
-using optional = nonstd::optional<T>;
-
-using nullopt_t = nonstd::nullopt_t;
-using bad_optional_access = nonstd::bad_optional_access;
-constexpr nullopt_t nullopt {nonstd::nullopt};
-
-template <typename T>
-constexpr optional<typename std::decay<T>::type> make_optional(T&& value)
-{
-    return nonstd::make_optional(std::forward<T>(value));
-}
-
-template <typename T, typename... ArgTs>
-constexpr optional<T> make_optional(ArgTs&&...args)
-{
-    return nonstd::make_optional<T>(std::forward<ArgTs>(args)...);
-}
-
-using in_place_t = nonstd::in_place_t;
-
-template <typename T>
-inline in_place_t in_place()
-{
-    return nonstd::in_place<T>();
-}
-
-template <std::size_t K>
-inline in_place_t in_place()
-{
-    return nonstd::in_place<K>();
-}
-
-template <typename T>
-inline in_place_t in_place_type()
-{
-    return nonstd::in_place_type<T>();
-}
-
-template <std::size_t K>
-inline in_place_t in_place_index()
-{
-    return nonstd::in_place_index<K>();
-}
+using nonstd::optional;
+using nonstd::nullopt_t;
+using nonstd::bad_optional_access;
+using nonstd::nullopt;
+using nonstd::make_optional;
+using nonstd::in_place_t;
+using nonstd::in_place;
+using nonstd::in_place_type;
+using nonstd::in_place_index;
 
 } /* namespace bt2s */
 
index 8cdafd848f4ec7bb8306167f10439b0f85288d7c..d3516376bc89d22e128c3f8d5e88ee1fba3089c2 100644 (file)
 
 namespace bt2s {
 
-template <typename CharT, typename TraitsT = std::char_traits<CharT>>
-using basic_string_view = bpstd::basic_string_view<CharT, TraitsT>;
-
-using string_view = bpstd::string_view;
-using wstring_view = bpstd::wstring_view;
-using u16string_view = bpstd::u16string_view;
-using u32string_view = bpstd::u32string_view;
+using bpstd::basic_string_view;
+using bpstd::string_view;
+using bpstd::wstring_view;
+using bpstd::u16string_view;
+using bpstd::u32string_view;
 
 } /* namespace bt2s */
 
This page took 0.025978 seconds and 4 git commands to generate.