tinyformat: force USE_VARIADIC_TEMPLATES #8000

pull laanwj wants to merge 2 commits into bitcoin:master from laanwj:2016_05_tinyformat_variadic changing 2 files +19 −26
  1. laanwj commented at 9:41 am on May 4, 2016: member

    Now that we started using c++11, force use of variadic templates.

    The autodetection may be wonky on some compilers, see discussion here and is unnecessary for us anyhow.

  2. tinyformat: force USE_VARIADIC_TEMPLATES
    Now that we started using c++11, force use of variadic templates.
    
    The autodetection may be wonky on some compilers, see discussion
    [here](https://github.com/bitcoin/bitcoin/pull/7982#issuecomment-216222357)
    and is unnecessary for us anyhow.
    9eaa0afa6e
  3. laanwj added the label Refactoring on May 4, 2016
  4. theuni commented at 9:57 am on May 4, 2016: member
    ut ACK
  5. laanwj commented at 10:07 am on May 4, 2016: member
    Looks like there is another tinyformat-related c++1 TODO here: https://github.com/bitcoin/bitcoin/blob/master/src/util.h#L83
  6. fanquake commented at 10:47 am on May 4, 2016: member
    utACK 9eaa0af
  7. jonasschnelli commented at 11:44 am on May 4, 2016: contributor
    utACK 9eaa0afa6ec5d3dd01e4d01121314ef51f2bc305
  8. util: switch LogPrint and error to variadic templates 08d7b563e9
  9. laanwj commented at 12:22 pm on May 4, 2016: member
    Added a second commit that makes LogPrint and error into variadic templates.
  10. theuni commented at 12:30 pm on May 4, 2016: member

    may as well use perfect forwarding here, since all args are universal references:

    0template<typename T1, typename... Args>
    1bool error(const char* fmt, T1&& v1, Args&&... args)
    2{
    3    LogPrintStr("ERROR: " + tfm::format(fmt, std::forward<T1>(v1), std::forward<Args>(args)...) + "\n");
    4...
    
  11. laanwj commented at 12:44 pm on May 4, 2016: member

    @cfields I use the same convention as the functions in tinyformat.h itself now:

    0template<typename T1, typename... Args>
    1std::string format(const char* fmt, const T1& v1, const Args&... args)
    2{
    3    std::ostringstream oss;
    4    format(oss, fmt, v1, args...);
    5    return oss.str();
    6}
    

    I’m not sure perfect forwarding would win anything unless it’s done at all levels.

  12. theuni commented at 5:57 am on May 5, 2016: member

    blah, I assumed if it used variadics it also forwarded nicely. Indeed, no point in changing.

    ut ACK 08d7b563e91ed2ad226ec2505a5a850ab869d2f0

  13. laanwj commented at 6:15 am on May 5, 2016: member

    blah, I assumed if it used variadics it also forwarded nicely. Indeed, no point in changing.

    Well I agree with changing it, but yea should probably do that at once throughout the entire thing, in a separate pull.

  14. laanwj merged this on May 5, 2016
  15. laanwj closed this on May 5, 2016

  16. laanwj referenced this in commit 42a6753382 on May 5, 2016
  17. laanwj referenced this in commit a2a3f4ba2c on Jun 27, 2016
  18. laanwj referenced this in commit 1666e37fb7 on Jun 27, 2016
  19. laanwj referenced this in commit 695041e495 on Jun 27, 2016
  20. zkbot referenced this in commit 6bad499c2a on Oct 25, 2016
  21. protonn referenced this in commit 2e09c3d7f1 on May 7, 2017
  22. codablock referenced this in commit 833385556a on Sep 16, 2017
  23. codablock referenced this in commit 165f5fb75e on Sep 19, 2017
  24. codablock referenced this in commit d55b78eb68 on Dec 20, 2017
  25. lateminer referenced this in commit 0320890116 on Jan 3, 2019
  26. furszy referenced this in commit 9ef9f5dea1 on Mar 27, 2020
  27. akshaynexus referenced this in commit 5c753ce7c2 on Mar 30, 2020
  28. nathanielcwm referenced this in commit 0e1fe3bbad on May 7, 2021
  29. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-09-29 01:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me