aboutsummaryrefslogtreecommitdiffstats
path: root/vbench/src/vbench/core/memory.h
blob: 749e7daef1501af4233658034e47a5321fa940f9 (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
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "string.h"

namespace vbench {

/**
 * Simple wrapper referencing a read-only region of memory.
 **/
struct Memory
{
    const char *data;
    size_t      size;
    Memory() : data(0), size(0) {}
    Memory(const char *d, size_t s) : data(d), size(s) {}
    Memory(const char *str) : data(str), size(strlen(str)) {}
    Memory(const string &str) : data(str.data()), size(str.size()) {}
};

} // namespace vbench