Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fmt::join does not support tuples #1322

Closed
jeremyong opened this issue Sep 23, 2019 · 6 comments
Closed

fmt::join does not support tuples #1322

jeremyong opened this issue Sep 23, 2019 · 6 comments

Comments

@jeremyong
Copy link
Contributor

Currently, fmt::join appears to only function on containers/ranges that support begin and end. It would be extremely convenient if fmt::join used the is_tuple_like trait to format each element with the separator as well.

@vitaut
Copy link
Contributor

vitaut commented Sep 23, 2019

Sounds reasonable. Will be happy to accept a PR =).

@jeremyong
Copy link
Contributor Author

@vitaut I'm looking at this now. Can I use if constexpr or are you trying to maintain backwards compatibility? I'd like to avoid using SFINAE unless absolutely needed

@vitaut
Copy link
Contributor

vitaut commented Sep 25, 2019

SFINAE is generally preferred for portability reasons but it's OK to use if constexpr for new non-essential features.

@jeremyong
Copy link
Contributor Author

I see that is_tuple_like is defined in ranges.h, but join is defined in format.h. The options are to put the specialization for tuples of join inside ranges.h or to move is_tuple_like to format.h. Thoughts?

@vitaut
Copy link
Contributor

vitaut commented Sep 25, 2019

I suggest putting it in ranges.h together with is_tuple_like. Eventually we should move the other overload of join there too. It's in format.h mostly for historical reasons.

@jeremyong
Copy link
Contributor Author

OK I'll work on this tonight after work, thanks

jeremyong added a commit to jeremyong/fmt that referenced this issue Sep 26, 2019
Address enhancement request fmtlib#1322.

The overload is provided in `ranges` (original `fmt::join` exists
currently in `format.h` for historical reasons.

Tests for prvalue and lvalue tuple arguments as well as the empty
tuple are provided in `ranges-test.cc`.
jeremyong added a commit to jeremyong/fmt that referenced this issue Sep 26, 2019
Address enhancement request fmtlib#1322.

The overload is provided in `ranges` (original `fmt::join` exists
currently in `format.h` for historical reasons.

Tests for prvalue and lvalue tuple arguments as well as the empty
tuple are provided in `ranges-test.cc`.
jeremyong added a commit to jeremyong/fmt that referenced this issue Sep 26, 2019
Address enhancement request fmtlib#1322.

The overload is provided in `ranges` (original `fmt::join` exists
currently in `format.h` for historical reasons.

Tests for prvalue and lvalue tuple arguments as well as the empty
tuple are provided in `ranges-test.cc`.
jeremyong added a commit to jeremyong/fmt that referenced this issue Sep 26, 2019
Address enhancement request fmtlib#1322.

The overload is provided in `ranges` (original `fmt::join` exists
currently in `format.h` for historical reasons.

Tests for prvalue and lvalue tuple arguments as well as the empty
tuple are provided in `ranges-test.cc`.
jeremyong added a commit to jeremyong/fmt that referenced this issue Sep 26, 2019
Address enhancement request fmtlib#1322.

The overload is provided in `ranges` (original `fmt::join` exists
currently in `format.h` for historical reasons.

Tests for prvalue and lvalue tuple arguments as well as the empty
tuple are provided in `ranges-test.cc`.
jeremyong added a commit to jeremyong/fmt that referenced this issue Sep 26, 2019
Address enhancement request fmtlib#1322.

The overload is provided in `ranges` (original `fmt::join` exists
currently in `format.h` for historical reasons.

Tests for prvalue and lvalue tuple arguments as well as the empty
tuple are provided in `ranges-test.cc`.
vitaut pushed a commit that referenced this issue Sep 27, 2019
Address enhancement request #1322.

The overload is provided in `ranges` (original `fmt::join` exists
currently in `format.h` for historical reasons.

Tests for prvalue and lvalue tuple arguments as well as the empty
tuple are provided in `ranges-test.cc`.
@vitaut vitaut closed this as completed Sep 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants