File: p2497.cpp

package info (click to toggle)
fast-float 8.1.0-0.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 892 kB
  • sloc: cpp: 7,252; ansic: 3,474; python: 366; sh: 37; makefile: 9
file content (16 lines) | stat: -rw-r--r-- 423 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "fast_float/fast_float.h"

#include <iostream>
#include <string>

int main() {
  std::string input = "3.1416 xyz ";
  double result;
  if (auto answer = fast_float::from_chars(
          input.data(), input.data() + input.size(), result)) {
    std::cout << "parsed the number " << result << std::endl;
    return EXIT_SUCCESS;
  }
  std::cerr << "failed to parse " << result << std::endl;
  return EXIT_FAILURE;
}