forked from mpusz/mp-units
gcc compilation error disabled (looks like a bug in a compiler)
This commit is contained in:
@@ -84,7 +84,13 @@ class UnitsConan(ConanFile):
|
|||||||
def package_info(self):
|
def package_info(self):
|
||||||
self.cpp_info.includedirs = ['include']
|
self.cpp_info.includedirs = ['include']
|
||||||
if self.settings.compiler == "gcc":
|
if self.settings.compiler == "gcc":
|
||||||
self.cpp_info.cxxflags = ["-fconcepts", "-Wno-literal-suffix", "-Wno-non-template-friend"]
|
self.cpp_info.cxxflags = [
|
||||||
|
"-fconcepts",
|
||||||
|
"-Wno-literal-suffix",
|
||||||
|
"-Wno-non-template-friend",
|
||||||
|
"-Wno-stringop-overflow",
|
||||||
|
"-Wno-pedantic"
|
||||||
|
]
|
||||||
|
|
||||||
def package_id(self):
|
def package_id(self):
|
||||||
self.info.settings.clear()
|
self.info.settings.clear()
|
||||||
|
@@ -65,6 +65,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
|
|||||||
INTERFACE
|
INTERFACE
|
||||||
-Wno-literal-suffix
|
-Wno-literal-suffix
|
||||||
-Wno-non-template-friend
|
-Wno-non-template-friend
|
||||||
|
-Wno-stringop-overflow
|
||||||
# TODO gcc:92101
|
# TODO gcc:92101
|
||||||
-Wno-pedantic
|
-Wno-pedantic
|
||||||
)
|
)
|
||||||
|
@@ -31,12 +31,14 @@ namespace units {
|
|||||||
|
|
||||||
constexpr basic_fixed_string(const CharT (&txt)[N + 1]) noexcept
|
constexpr basic_fixed_string(const CharT (&txt)[N + 1]) noexcept
|
||||||
{
|
{
|
||||||
for(std::size_t i = 0; i <= N; ++i)
|
for(std::size_t i = 0; i < N; ++i)
|
||||||
data_[i] = txt[i];
|
data_[i] = txt[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] constexpr std::size_t size() const noexcept { return N; }
|
[[nodiscard]] constexpr std::size_t size() const noexcept { return N; }
|
||||||
[[nodiscard]] constexpr const CharT* c_str() const noexcept { return data_; }
|
[[nodiscard]] constexpr const CharT* c_str() const noexcept { return data_; }
|
||||||
|
[[nodiscard]] constexpr const CharT& operator[](std::size_t index) const noexcept { return data_[index]; }
|
||||||
|
[[nodiscard]] constexpr CharT operator[](std::size_t index) noexcept { return data_[index]; }
|
||||||
|
|
||||||
// auto operator==(const basic_fixed_string &) = default;
|
// auto operator==(const basic_fixed_string &) = default;
|
||||||
|
|
||||||
@@ -79,15 +81,14 @@ namespace units {
|
|||||||
template<std::size_t N2>
|
template<std::size_t N2>
|
||||||
[[nodiscard]] constexpr friend basic_fixed_string<CharT, N + N2> operator+(const basic_fixed_string& lhs, const basic_fixed_string<CharT, N2>& rhs) noexcept
|
[[nodiscard]] constexpr friend basic_fixed_string<CharT, N + N2> operator+(const basic_fixed_string& lhs, const basic_fixed_string<CharT, N2>& rhs) noexcept
|
||||||
{
|
{
|
||||||
CharT txt[lhs.size() + rhs.size() + 1] = {};
|
CharT txt[N + N2 + 1] = {};
|
||||||
|
|
||||||
size_t i = 0;
|
for(size_t i = 0; i != N; ++i)
|
||||||
for(; i != lhs.size(); ++i)
|
txt[i] = lhs[i];
|
||||||
txt[i] = lhs.c_str()[i];
|
for(size_t i = 0; i != N2; ++i)
|
||||||
for(size_t j = 0; j != rhs.size(); ++j)
|
txt[N + i] = rhs[i];
|
||||||
txt[i + j] = rhs.c_str()[j];
|
|
||||||
|
|
||||||
return basic_fixed_string<CharT, N + N2>(txt);
|
return units::basic_fixed_string(txt);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user