Giter Club home page Giter Club logo

Comments (3)

liuzicheng1987 avatar liuzicheng1987 commented on August 26, 2024

I'm pretty sure it is. It's not only static, it is constexpr static.

It is necessary to support this syntax:

rfl::Field<std::string, "firstName">

So at compile time, the string "firstName" is copied into the class itself. I do not think that "firstName" would be persisted so I am pretty sure you couldn't just create a view.

Also, it is very important that this is all happening at compile time. So there really is no runtime overhead either way.

from reflect-cpp.

travnick avatar travnick commented on August 26, 2024

Looks like https://godbolt.org/ tricked me - string_view used to work once, but not any more.

Maybe in the future C++ versions it will work.

After translation phase 6, a string-literal that does not begin with an encoding-prefix is an ordinary string
literal. An ordinary string literal has type “array of n const char” where n is the size of the string as defined
below, has static storage duration (6.7.5), and is initialized with the given characters

from reflect-cpp.

liuzicheng1987 avatar liuzicheng1987 commented on August 26, 2024

Yes, I gave it a try myself and couldn't make it work either.

from reflect-cpp.

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.