Teuchos - Trilinos Tools Package
Version of the Day
Toggle main menu visibility
Loading...
Searching...
No Matches
parser
src
Teuchos_string.hpp
1
// @HEADER
2
// *****************************************************************************
3
// Teuchos: Common Tools Package
4
//
5
// Copyright 2004 NTESS and the Teuchos contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef TEUCHOS_STRING_HPP
11
#define TEUCHOS_STRING_HPP
12
13
#include <string>
14
#include <Teuchos_Assert.hpp>
15
16
namespace
Teuchos
{
17
18
/* some wrappers over std::string to let us
19
do all indexing with int */
20
21
inline
int
size(std::string
const
& s) {
22
return
int(s.size());
23
}
24
25
inline
std::string::reference at(std::string& s,
int
i) {
26
TEUCHOS_DEBUG_ASSERT(0 <= i);
27
TEUCHOS_DEBUG_ASSERT(i <
int
(s.size()));
28
return
s[std::size_t(i)];
29
}
30
31
inline
std::string::const_reference at(std::string
const
& s,
int
i) {
32
TEUCHOS_DEBUG_ASSERT(0 <= i);
33
TEUCHOS_DEBUG_ASSERT(i <
int
(s.size()));
34
return
s[std::size_t(i)];
35
}
36
37
inline
void
resize(std::string& s,
int
n) {
38
TEUCHOS_DEBUG_ASSERT(0 <= n);
39
s.resize(std::size_t(n));
40
}
41
42
}
43
44
#endif
45
46
Teuchos
The Teuchos namespace contains all of the classes, structs and enums used by Teuchos,...
Generated by
1.17.0