GithubHelp home page GithubHelp logo

Comments (7)

jbcoe avatar jbcoe commented on July 19, 2024 1

We need to look at other standard library types and do the same thing. No need to innovate here.

from value_types.

Twon avatar Twon commented on July 19, 2024

Perhaps I'm missing something but I can't get this example working for the use case. Currently, only the latest Visual Studio has support for the <print> header, any ideas what I am missing to reproduce this: https://godbolt.org/z/ahWacdanP

from value_types.

Ukilele avatar Ukilele commented on July 19, 2024

Here is the original sample: https://godbolt.org/z/zh9czreoK

Here is a "simplified" version which does not involve ranges, but my own custom type that is only formattable in a non-const verison (MyNonConstFormattableType) https://godbolt.org/z/sqoE5Txfj

It seems that both only work with clang 17.0.1 and options: -std=c++23 -stdlib=libc++

from value_types.

Ukilele avatar Ukilele commented on July 19, 2024

Regarding a solution: I just checked https://eel.is/c++draft/format.tuple#lib:format,formatter . This is the std::formatter for std::pair and std::tuple. The approach seems to be: If const T is formattable, then format takes a const std::tuple<T>& as parameter, otherwise it takes a std::tuple<T>& as parameter. Something similar was done at https://eel.is/c++draft/format.range, too.

from value_types.

Ukilele avatar Ukilele commented on July 19, 2024

I just learned, that libc++ does not define the macro __cpp_lib_format yet. This gets used in https://github.com/jbcoe/value_types/blob/main/indirect.h#L348 . So therefore under libc++ (which all my godbolt-samples used), the code will never work, because the #ifdef (#if (__cpp_lib_format >= 201907L)) in indirect.h will always be false.

from value_types.

jbcoe avatar jbcoe commented on July 19, 2024

Feel free to add your experiment in a PR and piggy-back off our test setup. We run on MSVC, Clang and GCC.

from value_types.

jbcoe avatar jbcoe commented on July 19, 2024

We've stripped out format support altogether so this is no longer an issue.

from value_types.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.