blob: faa0299f639deb97b467994d582570fe367bad06 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "utils.h"
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/util/exceptions.h>
namespace search::features::util {
template <typename T>
T strToNum(vespalib::stringref str)
{
vespalib::asciistream iss(str);
T retval = 0;
try {
iss >> retval;
} catch (const vespalib::IllegalArgumentException &) {
}
return retval;
}
}
|