mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2025-12-07 01:06:54 +08:00
This modifies no logic, it simply adds the keyword `noexcept` I believe this is 100% correct. It calls methods that are not guaranteed to be `noexcept`, such as `operator[]` but have no logically way of throwing.
38 lines
773 B
C++
38 lines
773 B
C++
// This file is distributed under the BSD License.
|
|
// See "license.txt" for details.
|
|
// Copyright 2009-2012, Jonathan Turner (jonathan@emptycrate.com)
|
|
// Copyright 2009-2017, Jason Turner (jason@emptycrate.com)
|
|
// http://www.chaiscript.com
|
|
|
|
#ifndef CHAISCRIPT_UTILITY_STATIC_STRING_HPP_
|
|
#define CHAISCRIPT_UTILITY_STATIC_STRING_HPP_
|
|
|
|
namespace chaiscript
|
|
{
|
|
namespace utility
|
|
{
|
|
|
|
struct Static_String
|
|
{
|
|
template<size_t N>
|
|
Static_String(const char (&str)[N]) noexcept
|
|
: m_size(N-1), data(&str[0])
|
|
{
|
|
}
|
|
|
|
size_t size() const noexcept {
|
|
return m_size;
|
|
}
|
|
|
|
const char *c_str() const noexcept {
|
|
return data;
|
|
}
|
|
|
|
const size_t m_size;
|
|
const char *data = nullptr;
|
|
};
|
|
}
|
|
}
|
|
|
|
#endif
|