-
Notifications
You must be signed in to change notification settings - Fork 25
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
Changes signature of name() from char const* to char const[] #10
base: develop
Are you sure you want to change the base?
Conversation
* This makes it a lot easier to get the size of the string at compile-time, and in general will improve usage with a compile-time string library Signed-off-by: Julien Blanc <[email protected]>
Is |
I show how a descriptor name is turned into a compile-time Hana string here: https://lists.boost.org/Archives/boost/2020/09/250046.php Not sure how your compile-time string works, but it should be similar. |
I was more thinking of a library like this one: https://github.com/akrzemi1/static_string . It provides direct construction from a Sure, you can write some adapters, but what for? Unless I'm missing something, returning an array gives more information directly available. I see some benefits, and fails to see drawbacks with this change, since |
I'm not 100% sure this won't create problems for a built-in compiler implementation down the road. I know that |
Ok, i can't tell either, i'm not a compiler writer. Maybe just keep that open until you can get a definitive answer on that point. Do you want me to create an issue ? |
I'll keep it open as a reminder. I've been looking into implementing Describe on top of the current reflection proposals (P2320 and P1240) and at this point it's basically impossible because their |
Wouldn't std::array be a better choice in this regard (at least it's better than an std::string) ? Obviously there's a miss for a vocabulary compile time string, as it is a needed feature for any compile time reflection feature. |
The original compile-time At the moment I think that |
So I ran into this. I use CNTTP/NTTP for my library and string literals cannot be used there. I had to work around like template<typename, typename>
struct describe_member_impl;
template<typename T, std::size_t... Is>
struct describe_member_impl<T, std::index_sequence<Is...>> {
static constexpr char const name[sizeof...( Is )]{ T::name[Is]... };
using type = json_link<name, traits::member_type_of_t<DAW_TYPEOF( T::pointer )>>;
};
template<typename T>
using describe_member =
describe_member_impl<T,
std::make_index_sequence<std::char_traits<char>::length( T::name ) + 1>>; Another nice addition to T::pointer, T::type or something like that. |
compile-time, and in general will improve usage with a compile-time
string library
Signed-off-by: Julien Blanc [email protected]