]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
osd: migrate from boost::variant to std::variant 63414/head
authorKefu Chai <tchaikov@gmail.com>
Wed, 21 May 2025 03:38:47 +0000 (11:38 +0800)
committerKefu Chai <tchaikov@gmail.com>
Wed, 16 Jul 2025 04:49:47 +0000 (12:49 +0800)
commit09d27310b3b27f427dba593882e63a2d5beac542
tree4093d5bb7f06c841fdc109785476b5b23847326f
parentc2bee4c7922ad467c591e8f7faea17139f220a3f
osd: migrate from boost::variant to std::variant

Replace boost::variant with std::variant throughout the OSD-related
codebase. This change reduces third-party dependencies by leveraging
the C++ standard library alternative.

Changes:
- common/inline_variant.h: Replace the existing match() helper with a
  wrapper around std::visit. The previous implementation constructed a
  visitor class from given functions; the new implementation provides
  equivalent functionality using standard library primitives.

- osd/osd_types.h: Add templated operator<< overload for std::variant.
  Since boost::variant provided a built-in operator<< that we relied on,
  and std::variant does not include this functionality, we implement our
  own formatter. To avoid ambiguous overload resolution (where types
  implicitly convertible to variant alternatives could match both the
  variant formatter and their native formatters), the template requires
  at least one alternative type parameter.

This migration maintains existing functionality while eliminating the
boost::variant dependency.

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/common/inline_variant.h
src/osd/ECTransactionL.h
src/osd/PGTransaction.h
src/osd/osd_types.cc
src/osd/osd_types.h
src/test/osd/test_pg_transaction.cc