cpp-common/bt2: make `ConstComponentPorts::operator[](bt2c::CStringView)` return...
[babeltrace.git] / src / cpp-common / bt2 / component-port.hpp
index 110c9b62a3787be4a83cbf084024278f19c344c1..930b2e6f0ee2fbcd121d2347a84b547d2824f5ef 100644 (file)
@@ -8,7 +8,6 @@
 #define BABELTRACE_CPP_COMMON_BT2_COMPONENT_PORT_HPP
 
 #include <cstdint>
-#include <string>
 
 #include <babeltrace2/babeltrace.h>
 
@@ -262,7 +261,7 @@ public:
     }
 
     Port operator[](std::uint64_t index) const noexcept;
-    Port operator[](bt2c::CStringView name) const noexcept;
+    OptionalBorrowedObject<Port> operator[](bt2c::CStringView name) const noexcept;
     Iterator begin() const noexcept;
     Iterator end() const noexcept;
 };
@@ -503,10 +502,10 @@ ConstComponentPorts<LibCompT, LibPortT>::operator[](const std::uint64_t index) c
 }
 
 template <typename LibCompT, typename LibPortT>
-typename ConstComponentPorts<LibCompT, LibPortT>::Port
+OptionalBorrowedObject<typename ConstComponentPorts<LibCompT, LibPortT>::Port>
 ConstComponentPorts<LibCompT, LibPortT>::operator[](const bt2c::CStringView name) const noexcept
 {
-    return Port {_Spec::portByName(this->libObjPtr(), name)};
+    return _Spec::portByName(this->libObjPtr(), name);
 }
 
 template <typename LibCompT, typename LibPortT>
This page took 0.035484 seconds and 4 git commands to generate.