Namespaces
Variants
Views
Actions

Talk:cpp/compiler support/17

From cppreference.com

Insert non-formatted text hereThe page suggests libc++ supports from_chars except for long doubles since version 14, but I believe this is untrue since a simple code such as this:

#include <charconv>
#include<string_view>
 
int main(){
	std::string_view s="3.4";
	float f;
	constexpr std::errc ok{};
	const char*begin=s.data(),*end=begin+s.size();
	auto result=std::from_chars(begin,end,f);
	if(result.ec==ok&&result.ptr==end){return 0;}
	return 1;
}

lands on the `deleted` version of `from_chars`. I believe it's only supported for integers. In fact, LLVM's tests for charconv has a lot of `// TODO Enable once std::from_chars has floating point support.` in it (verified in llvmorg.16.0.3 at the time of writing).

The above source code has been wrapped in appropriate tags (as seen in the History) for the convenience of readers. --Space Mission (talk) 12:33, 5 May 2023 (PDT)