libcamera: base: utils: Simplify operator<< for Duration

There is no real need for a function template. It is not defined in a
header file, so it has limited availability, and there exists only a
single instantion.

So convert it to use `std::ostream` directly, like most `operator<<`
in the code base.

Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Barnabás Pőcze
2026-01-15 11:51:47 +01:00
parent 67fd7d720b
commit 461e7d3d73
2 changed files with 3 additions and 12 deletions

View File

@@ -424,9 +424,7 @@ scope_exit(EF) -> scope_exit<EF>;
} /* namespace utils */
#ifndef __DOXYGEN__
template<class CharT, class Traits>
std::basic_ostream<CharT, Traits> &operator<<(std::basic_ostream<CharT, Traits> &os,
const utils::Duration &d);
std::ostream &operator<<(std::ostream &os, const utils::Duration &d);
#endif
} /* namespace libcamera */

View File

@@ -658,11 +658,9 @@ void ScopeExitActions::release()
} /* namespace utils */
#ifndef __DOXYGEN__
template<class CharT, class Traits>
std::basic_ostream<CharT, Traits> &operator<<(std::basic_ostream<CharT, Traits> &os,
const utils::Duration &d)
std::ostream &operator<<(std::ostream &os, const utils::Duration &d)
{
std::basic_ostringstream<CharT, Traits> s;
std::ostringstream s;
s.flags(os.flags());
s.imbue(os.getloc());
@@ -671,11 +669,6 @@ std::basic_ostream<CharT, Traits> &operator<<(std::basic_ostream<CharT, Traits>
s << d.get<std::micro>() << "us";
return os << s.str();
}
template
std::basic_ostream<char, std::char_traits<char>> &
operator<< <char, std::char_traits<char>>(std::basic_ostream<char, std::char_traits<char>> &os,
const utils::Duration &d);
#endif
} /* namespace libcamera */