cpp-common/bt2: use bt2c::CStringView in parameters and return values throughout
[babeltrace.git] / src / cpp-common / bt2 / component-port.hpp
index 1ab7a850af271a84440387fb11c63e34f1a04be6..110c9b62a3787be4a83cbf084024278f19c344c1 100644 (file)
@@ -262,8 +262,7 @@ public:
     }
 
     Port operator[](std::uint64_t index) const noexcept;
-    Port operator[](const char *name) const noexcept;
-    Port operator[](const std::string& name) const noexcept;
+    Port operator[](bt2c::CStringView name) const noexcept;
     Iterator begin() const noexcept;
     Iterator end() const noexcept;
 };
@@ -505,18 +504,11 @@ ConstComponentPorts<LibCompT, LibPortT>::operator[](const std::uint64_t index) c
 
 template <typename LibCompT, typename LibPortT>
 typename ConstComponentPorts<LibCompT, LibPortT>::Port
-ConstComponentPorts<LibCompT, LibPortT>::operator[](const char * const name) const noexcept
+ConstComponentPorts<LibCompT, LibPortT>::operator[](const bt2c::CStringView name) const noexcept
 {
     return Port {_Spec::portByName(this->libObjPtr(), name)};
 }
 
-template <typename LibCompT, typename LibPortT>
-typename ConstComponentPorts<LibCompT, LibPortT>::Port
-ConstComponentPorts<LibCompT, LibPortT>::operator[](const std::string& name) const noexcept
-{
-    return (*this)[name.data()];
-}
-
 template <typename LibCompT, typename LibPortT>
 typename ConstComponentPorts<LibCompT, LibPortT>::Iterator
 ConstComponentPorts<LibCompT, LibPortT>::begin() const noexcept
This page took 0.02424 seconds and 4 git commands to generate.