aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib/src/vespa/vespalib/stllike/lexical_cast.h
blob: 0e23f87c6fe8d8e7ac478eee03614557b85967e6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/vespalib/stllike/asciistream.h>

namespace vespalib {

template <typename T>
T lexical_cast(const stringref s)
{
    T v;
    asciistream is(s);
    is >> v;
    return v;
}

}