Put ostream operator<< for PresentationInfo in std namespace

Fix compilation error seen with gcc 12.0.1 on Fedora 36:

In file included from ../libs/ardour/ardour/variant.h:30,
                 from ../libs/ardour/ardour/parameter_descriptor.h:25,
                 from ../libs/ardour/ardour/automation_control.h:39,
                 from ../libs/ardour/ardour/amp.h:30,
                 from ../libs/ardour/session.cc:61:
../libs/pbd/pbd/compose.h: In instantiation of ‘StringPrivate::Composition& StringPrivate::Composition::arg(const T&) [with T = ARDOUR::PresentationInfo]’:
../libs/pbd/pbd/compose.h:277:31:   required from ‘std::string string_compose(const std::string&, const T1&, const T2&, const T3&, const T4&) [with T1 = std::__cxx11::basic_string<char>; T2 = unsigned int; T3 = std::__cxx11::basic_string<char>; T4 = ARDOUR::PresentationInfo; std::string = std::__cxx11::basic_string<char>]’
../libs/ardour/session.cc:3268:4:   required from here
../libs/pbd/pbd/compose.h:122:20: error: no match for ‘operator<<’ (operand types are ‘std::ostringstream’ {aka ‘std::__cxx11::basic_ostringstream<char>’} and ‘const ARDOUR::PresentationInfo’)
  122 |                 os << obj;
      |                 ~~~^~~~~~

This might also fix a similar problem with clang, and
https://github.com/Ardour/ardour/commit/5bbfac23808 can be backed out.
This commit is contained in:
Mads Kiilerich 2022-04-09 18:03:21 -06:00 committed by Paul Davis
parent 705de9389b
commit 217519b1b4
2 changed files with 3 additions and 1 deletions

View File

@ -294,6 +294,8 @@ class LIBARDOUR_API PresentationInfo : public PBD::Stateful
}
namespace std {
std::ostream& operator<<(std::ostream& o, ARDOUR::PresentationInfo const& rid);
}
#endif /* __libardour_presentation_info_h__ */

View File

@ -318,7 +318,7 @@ PresentationInfo::operator= (PresentationInfo const& other)
}
std::ostream&
operator<<(std::ostream& o, ARDOUR::PresentationInfo const& pi)
std::operator<<(std::ostream& o, ARDOUR::PresentationInfo const& pi)
{
return o << pi.order() << '/' << enum_2_string (pi.flags()) << '/' << pi.color();
}