Why isn't it const fn yet?

String::is_empty in std::string is fn instead of const fn for now.

  1. I'm curious why isn't it const fn yet?
  2. If we can stablize it to const fn, how can I start for it?

str::is_empty is const and probably what you are looking for. Strings are heap allocated and have a destructor, which makes the pretty much unusable in const contexts as of right now.

5 Likes

Thanks for the answer!
I was curious how to stablize String::is_empty to const fn but I got it why it isn't const fn.

1 Like