mirror of
https://github.com/boostorg/convert.git
synced 2026-01-19 04:02:18 +00:00
18 lines
346 B
C++
18 lines
346 B
C++
#include <boost/convert.hpp>
|
|
#include <boost/convert/charconv.hpp>
|
|
#include <iostream>
|
|
|
|
int main()
|
|
{
|
|
auto cnv4 = boost::cnv::charconv();
|
|
std::string PuNum = "2";
|
|
auto optPuNum = boost::convert<size_t>(PuNum, cnv4);
|
|
|
|
if (optPuNum)
|
|
std::cout << *optPuNum << "\n";
|
|
else
|
|
std::cout << "nullopt\n";
|
|
|
|
return 0;
|
|
}
|