-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtils.cpp
More file actions
41 lines (38 loc) · 1.36 KB
/
Utils.cpp
File metadata and controls
41 lines (38 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* Utils.cpp :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yfarini <yfarini@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/01/10 12:18:03 by yfarini #+# #+# */
/* Updated: 2023/01/10 17:35:11 by yfarini ### ########.fr */
/* */
/* ************************************************************************** */
#include "Utils.hpp"
long long custom_stoll(const std::string &val)
{
long long res = 0;
try
{
res = std::stoll(val);
}
catch(const std::exception& e)
{
res = std::numeric_limits<long long>::max();
}
return res;
}
double custom_stod(const std::string &val)
{
double res = 0;
try
{
res = std::stod(val);
}
catch(const std::exception& e)
{
res = std::numeric_limits<double>::quiet_NaN();
}
return res;
}