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

#1322 tuple join #1330

Closed
wants to merge 1 commit into from
Closed

#1322 tuple join #1330

wants to merge 1 commit into from

Conversation

jeremyong
Copy link
Contributor

I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.

This addresses the enhancement proposed in #1322 .

This is my initial 10 minute pass or so for early review (needs cleanup, documentation, more tests, etc). Note that this code only works with C++17... it's been a while since I've needed to code in the earlier standards. Feel free to comment or leave feedback, thanks.

@jeremyong
Copy link
Contributor Author

jeremyong commented Sep 26, 2019

Things I'm aware of that need to be done:

  • Handle other value categories within the tuples (and test them, aka pointers, references, etc).
  • Mark things as constexpr and noexcept as appropriate
  • Backport functionality or disable overload if the compiler doesn't support it

Note that I opted to use simple ADL instead of template specialization

include/fmt/format.h Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
include/fmt/format.h Outdated Show resolved Hide resolved
@jeremyong
Copy link
Contributor Author

One thing that wasn't immediately obvious to me was how to do the concatenation using a fold on C++17 enabled compilers (aka without recursion). I think this should be possible but I'm not sure whether it's worth losing the clarity of this approach (which is simpler) for some indeterminate compile time gains. I'm open to suggestions here though.

@jeremyong jeremyong changed the title Preliminary commit (early viewing only, do not check in) #1322 tuple join preliminary commit (early viewing only, do not check in) Sep 26, 2019
@vitaut
Copy link
Contributor

vitaut commented Sep 26, 2019

I think recursive solution is fine. It can even be ported to pre-C++17. AFACS the only C++17 construct is if constexpr.

@jeremyong
Copy link
Contributor Author

OK does the FMT_CONSTEXPR macro expand to constexpr if available?

@vitaut
Copy link
Contributor

vitaut commented Sep 26, 2019

FMT_CONSTEXPR expands to constexpr or inline (to be used with function definitions).

@jeremyong jeremyong changed the title #1322 tuple join preliminary commit (early viewing only, do not check in) #1322 tuple join Sep 26, 2019
@jeremyong jeremyong force-pushed the tuple_join branch 3 times, most recently from 151ee37 to b282d6b Compare September 26, 2019 03:48
@jeremyong
Copy link
Contributor Author

jeremyong commented Sep 26, 2019

@vitaut I believe all feedback is now addressed and I have finished my own TODOs. (ignore force-pushes to my branch. that was for cleanup of the history)

@jeremyong
Copy link
Contributor Author

Last push addresses a caught unused-parameter warning on GCC and fixes a documentation build issue I noticed.

@vitaut
Copy link
Contributor

vitaut commented Sep 26, 2019

Looks great! Just one minor comment regarding RST and please run clang-format to format your changes.

doc/api.rst Outdated Show resolved Hide resolved
@jeremyong
Copy link
Contributor Author

I use the clang-format extension which runs on save so we should be good there

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
Copy link
Contributor Author

OK done. The change was squashed into the single commit as before.

@vitaut
Copy link
Contributor

vitaut commented Sep 27, 2019

Merged with minor tweaks in b4f1988. Thanks!

@vitaut vitaut closed this Sep 27, 2019
@jeremyong
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants