Support std::variant

Open
#78 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
tooling

Research direction

Start with the supplied main() reproducer and compare its std::variant behavior with the boost::variant version. Trace how boost::format handles the formatted argument, then verify that the reproducer works with std::variant and retains existing boost::variant behavior.

Written by the indexing model from the issue text.

Description

Hello. I have a problem with using std::variant with boost::format.
Visual Studio 2019 - 16.7.3
boost - 1.74

Sample code:

`
#include < iostream>
#include < variant>
#include <boost/variant.hpp>
#include <boost/format.hpp>

typedef std::variant<uint16_t, std::string> MemCaptureIdType;
//typedef boost::variant<uint16_t, std::string> MemCaptureIdType;

std::ostream& operator<<(std::ostream& os, const MemCaptureIdType& type)
{
return os;
}

int main()
{
auto tmp1 = MemCaptureIdType(0);

auto tmp = boost::format("%1%") % tmp1;

return 0;

}
`

But it works when I use boost::variant.
I think we need to support std::variant.

Dominant language
C++
Stars
31
Forks
53
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/format

All issues in boostorg/format

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.