Add external include guard

This commit is contained in:
Krystian Stasiowski
2020-02-28 14:52:07 -05:00
parent 18f89ef078
commit e28a70f281

View File

@ -11,7 +11,10 @@
#ifndef BOOST_STATIC_STRING_STATIC_STRING_HPP #ifndef BOOST_STATIC_STRING_STATIC_STRING_HPP
#define BOOST_STATIC_STRING_STATIC_STRING_HPP #define BOOST_STATIC_STRING_STATIC_STRING_HPP
// External include guard
#ifndef BOOST_STATIC_STRING_CONFIG_HPP
#include <boost/static_string/config.hpp> #include <boost/static_string/config.hpp>
#endif
#include <algorithm> #include <algorithm>
#include <cstdint> #include <cstdint>
@ -5038,13 +5041,8 @@ insert(
const std::size_t count = detail::distance(first, last); const std::size_t count = detail::distance(first, last);
const std::size_t index = pos - curr_data; const std::size_t index = pos - curr_data;
const auto first_addr = &*first; const auto first_addr = &*first;
// gcc's static analyzer does not recognize exit via BOOST_STATIC_STRING_THROW_IF(
// exception as non-evaluation count > max_size() - curr_size, std::length_error("count > max_size() - size()"));
if (count > max_size() - curr_size)
BOOST_STATIC_STRING_THROW(
std::length_error("count > max_size() - size()"));
else
{
const bool inside = detail::ptr_in_range(curr_data, curr_data + curr_size, first_addr); const bool inside = detail::ptr_in_range(curr_data, curr_data + curr_size, first_addr);
if (!inside || (inside && (first_addr + count <= pos))) if (!inside || (inside && (first_addr + count <= pos)))
{ {
@ -5068,7 +5066,6 @@ insert(
} }
this->set_size(curr_size + count); this->set_size(curr_size + count);
return curr_data + index; return curr_data + index;
}
} }
template<std::size_t N, typename CharT, typename Traits> template<std::size_t N, typename CharT, typename Traits>