sdbusplus reading InterfacesAdded issue: not all variants are created equal
Paul Fertser
fercerpav at gmail.com
Sat Dec 25 06:21:00 AEDT 2021
On Thu, Dec 23, 2021 at 10:24:30AM -0600, Patrick Williams wrote:
> You could pretty easily add a `merge_variant` on top of this that
> would be the union of all the variant types.
This seems to work but I have near-zero clue about templates
meta-programming, please bear with me. Does this look suitable as an
another sdbusplus utility, should I send it for review after adding
docs?
template <typename T, typename... Unused>
struct merge_variant
{
using type = T;
};
template <typename D, typename... Done, typename... First, typename... Rest>
struct merge_variant<std::variant<D, Done...>, std::variant<First...>, Rest...>
: public merge_variant<
sdbusplus::utility::dedup_variant_t<D, Done..., First...>, Rest...>
{
};
template <typename... T>
using merge_variant_t = typename merge_variant<T...>::type;
--
Be free, use free (http://www.gnu.org/philosophy/free-sw.html) software!
mailto:fercerpav at gmail.com
More information about the openbmc
mailing list