All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Fertser <fercerpav@gmail.com>
To: Patrick Williams <patrick@stwcx.xyz>
Cc: openbmc@lists.ozlabs.org
Subject: Re: sdbusplus reading InterfacesAdded issue: not all variants are created equal
Date: Fri, 24 Dec 2021 22:21:00 +0300	[thread overview]
Message-ID: <YcYdnOrekbXDvm5F@home.paul.comp> (raw)
In-Reply-To: <YcSivm8L7jKd/7gy@heinlein>

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@gmail.com

  parent reply	other threads:[~2021-12-24 19:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-23 15:45 sdbusplus reading InterfacesAdded issue: not all variants are created equal Paul Fertser
2021-12-23 16:24 ` Patrick Williams
2021-12-24 12:53   ` Paul Fertser
2021-12-24 19:21   ` Paul Fertser [this message]
2021-12-23 18:14 ` Ed Tanous
2021-12-24 12:48   ` Paul Fertser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YcYdnOrekbXDvm5F@home.paul.comp \
    --to=fercerpav@gmail.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=patrick@stwcx.xyz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.