mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2024-12-23 21:25:49 +00:00
workaround for clang3.2(sha1)
This commit is contained in:
parent
3fd2451163
commit
5c9a8153de
6 changed files with 189 additions and 85 deletions
|
@ -31,21 +31,21 @@ namespace sprout {
|
||||||
first, last,
|
first, last,
|
||||||
*sprout::weed::lim<sprout::container_traits<Result>::static_size>(
|
*sprout::weed::lim<sprout::container_traits<Result>::static_size>(
|
||||||
sprout::weed::replace('>')
|
sprout::weed::replace('>')
|
||||||
[sprout::weed::lit('>') | "→" | "~" | "ー"]
|
[sprout::weed::lit('>') | "\x81\xA8"/*"→"*/ | "\x81\x60"/*"~"*/ | "\x81\5B"/*"ー"*/]
|
||||||
| sprout::weed::replace('<')
|
| sprout::weed::replace('<')
|
||||||
[sprout::weed::lit('<') | "←" | "★" | "☆"]
|
[sprout::weed::lit('<') | "\x81\xA9"/*"←"*/ | "\x81\x9A"/*"★"*/ | "\x81\x99"/*"☆"*/]
|
||||||
| sprout::weed::replace('+')
|
| sprout::weed::replace('+')
|
||||||
[sprout::weed::lit('+') | "あ" | "ぁ" | "お" | "ぉ"]
|
[sprout::weed::lit('+') | "\x82\xA0"/*"あ"*/ | "\x82\x9F"/*"ぁ"*/ | "\x82\xA8"/*"お"*/ | "\x82\xA7"/*"ぉ"*/]
|
||||||
| sprout::weed::replace('-')
|
| sprout::weed::replace('-')
|
||||||
[sprout::weed::lit('-') | "っ" | "ッ"]
|
[sprout::weed::lit('-') | "\x82\xC1"/*"っ"*/ | "\x83\x62"/*"ッ"*/]
|
||||||
| sprout::weed::replace('.')
|
| sprout::weed::replace('.')
|
||||||
[sprout::weed::lit('.') | "!"]
|
[sprout::weed::lit('.') | "\x81\x49"/*"!"*/]
|
||||||
| sprout::weed::replace(',')
|
| sprout::weed::replace(',')
|
||||||
[sprout::weed::lit(',') | "?"]
|
[sprout::weed::lit(',') | "\x81\x48"/*"?"*/]
|
||||||
| sprout::weed::replace('[')
|
| sprout::weed::replace('[')
|
||||||
[sprout::weed::lit('[') | "「" | "『"]
|
[sprout::weed::lit('[') | "\x81\x75"/*"「"*/ | "\x81\x77"/*"『"*/]
|
||||||
| sprout::weed::replace(']')
|
| sprout::weed::replace(']')
|
||||||
[sprout::weed::lit(']') | "」" | "』"]
|
[sprout::weed::lit(']') | "\x81\x76"/*"」"*/ | "\x81\x78"/*"』"*/]
|
||||||
| sprout::weed::replace(' ')
|
| sprout::weed::replace(' ')
|
||||||
[sprout::weed::char_]
|
[sprout::weed::char_]
|
||||||
)
|
)
|
||||||
|
|
|
@ -15,6 +15,9 @@
|
||||||
#include <sprout/range/algorithm/fixed/copy.hpp>
|
#include <sprout/range/algorithm/fixed/copy.hpp>
|
||||||
#include <sprout/operation/fixed/set.hpp>
|
#include <sprout/operation/fixed/set.hpp>
|
||||||
#include <sprout/bit/rotate.hpp>
|
#include <sprout/bit/rotate.hpp>
|
||||||
|
#ifdef SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE
|
||||||
|
# include <sprout/workaround/recursive_function_template.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace sprout {
|
namespace sprout {
|
||||||
static_assert(CHAR_BIT == 8, "CHAR_BIT == 8");
|
static_assert(CHAR_BIT == 8, "CHAR_BIT == 8");
|
||||||
|
@ -55,6 +58,133 @@ namespace sprout {
|
||||||
)
|
)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
#ifdef SPROUT_WORKAROUND_NOT_TERMINATE_RECURSIVE_CONSTEXPR_FUNCTION_TEMPLATE
|
||||||
|
template<int D = 16, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_CONTINUE(D)>
|
||||||
|
SPROUT_CONSTEXPR sha1 const process(
|
||||||
|
sprout::array<std::uint32_t, 5> const& h,
|
||||||
|
sprout::array<std::uint8_t, 64> const& block,
|
||||||
|
std::size_t block_byte_index,
|
||||||
|
std::uint64_t bit_count
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return block_byte_index != 64
|
||||||
|
? const_type(h, block, block_byte_index, bit_count)
|
||||||
|
: const_type(h, block, 0, bit_count).process_block<D + 1>()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
template<int D = 16, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_BREAK(D)>
|
||||||
|
SPROUT_CONSTEXPR sha1 const process(
|
||||||
|
sprout::array<std::uint32_t, 5> const& h,
|
||||||
|
sprout::array<std::uint8_t, 64> const& block,
|
||||||
|
std::size_t block_byte_index,
|
||||||
|
std::uint64_t bit_count
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return sprout::throw_recursive_function_template_instantiation_exeeded();
|
||||||
|
}
|
||||||
|
template<int D, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_CONTINUE(D)>
|
||||||
|
SPROUT_CONSTEXPR sha1 const process_block_2(
|
||||||
|
std::uint32_t a, std::uint32_t b, std::uint32_t c, std::uint32_t d, std::uint32_t e,
|
||||||
|
std::size_t i, std::uint32_t f, std::uint32_t k
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return process_block_1<D + 1>(
|
||||||
|
sprout::left_rotate(a, 5) + f + e + k + calc_w(i),
|
||||||
|
a,
|
||||||
|
sprout::left_rotate(b, 30),
|
||||||
|
c,
|
||||||
|
d,
|
||||||
|
i + 1
|
||||||
|
);
|
||||||
|
}
|
||||||
|
template<int D, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_BREAK(D)>
|
||||||
|
SPROUT_CONSTEXPR sha1 const process_block_2(
|
||||||
|
std::uint32_t a, std::uint32_t b, std::uint32_t c, std::uint32_t d, std::uint32_t e,
|
||||||
|
std::size_t i, std::uint32_t f, std::uint32_t k
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return sprout::throw_recursive_function_template_instantiation_exeeded();
|
||||||
|
}
|
||||||
|
template<int D, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_CONTINUE(D)>
|
||||||
|
SPROUT_CONSTEXPR sha1 const process_block_1(
|
||||||
|
std::uint32_t a, std::uint32_t b, std::uint32_t c, std::uint32_t d, std::uint32_t e,
|
||||||
|
std::size_t i = 0
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return i < 80
|
||||||
|
? process_block_2<D + 1>(
|
||||||
|
a, b, c, d, e,
|
||||||
|
i,
|
||||||
|
i < 20 ? (b & c) | (~b & d)
|
||||||
|
: i < 40 ? b ^ c ^ d
|
||||||
|
: i < 60 ? (b & c) | (b & d) | (c & d)
|
||||||
|
: b ^ c ^ d
|
||||||
|
,
|
||||||
|
i < 20 ? 0x5A827999
|
||||||
|
: i < 40 ? 0x6ED9EBA1
|
||||||
|
: i < 60 ? 0x8F1BBCDC
|
||||||
|
: 0xCA62C1D6
|
||||||
|
)
|
||||||
|
: sha1(
|
||||||
|
sprout::array<std::uint32_t, 5>{{h_[0] + a, h_[1] + b, h_[2] + c, h_[3] + d, h_[4] + e}},
|
||||||
|
block_,
|
||||||
|
block_byte_index_,
|
||||||
|
bit_count_
|
||||||
|
)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
template<int D, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_BREAK(D)>
|
||||||
|
SPROUT_CONSTEXPR sha1 const process_block_1(
|
||||||
|
std::uint32_t a, std::uint32_t b, std::uint32_t c, std::uint32_t d, std::uint32_t e,
|
||||||
|
std::size_t i = 0
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
return sprout::throw_recursive_function_template_instantiation_exeeded();
|
||||||
|
}
|
||||||
|
template<int D, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_CONTINUE(D)>
|
||||||
|
SPROUT_CONSTEXPR sha1 const process_block() const {
|
||||||
|
return process_block_1<D + 1>(h_[0], h_[1], h_[2], h_[3], h_[4]);
|
||||||
|
}
|
||||||
|
template<int D, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_BREAK(D)>
|
||||||
|
SPROUT_CONSTEXPR sha1 const process_block() const {
|
||||||
|
return sprout::throw_recursive_function_template_instantiation_exeeded();
|
||||||
|
}
|
||||||
|
template<int D = 16, typename Iterator, typename... Args, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_CONTINUE(D)>
|
||||||
|
SPROUT_CONSTEXPR typename std::enable_if<sizeof...(Args) == 64, sha1 const>::type
|
||||||
|
process_block_impl(Iterator first, Iterator last, Args... args) const {
|
||||||
|
return first == last ? process<D + 1>(
|
||||||
|
h_,
|
||||||
|
sprout::make_array<std::uint8_t>(args...),
|
||||||
|
64,
|
||||||
|
bit_count_ + 64 * 8
|
||||||
|
)
|
||||||
|
: sprout::throw_recursive_function_template_instantiation_exeeded()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
template<int D = 16, typename Iterator, typename... Args, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_BREAK(D)>
|
||||||
|
SPROUT_CONSTEXPR typename std::enable_if<sizeof...(Args) == 64, sha1 const>::type
|
||||||
|
process_block_impl(Iterator first, Iterator last, Args... args) const {
|
||||||
|
return sprout::throw_recursive_function_template_instantiation_exeeded();
|
||||||
|
}
|
||||||
|
template<int D = 16, typename Iterator, typename... Args, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_CONTINUE(D)>
|
||||||
|
SPROUT_CONSTEXPR typename std::enable_if<sizeof...(Args) != 64, sha1 const>::type
|
||||||
|
process_block_impl(Iterator first, Iterator last, Args... args) const {
|
||||||
|
return first == last ? process<D + 1>(
|
||||||
|
h_,
|
||||||
|
sprout::get_internal(sprout::range::fixed::copy(sprout::make_array<std::uint8_t>(args...), sprout::sub(block_, block_byte_index_))),
|
||||||
|
block_byte_index_ + sizeof...(Args),
|
||||||
|
bit_count_ + sizeof...(Args) * 8
|
||||||
|
)
|
||||||
|
: block_byte_index_ + sizeof...(Args) == 64 ? sprout::throw_recursive_function_template_instantiation_exeeded()
|
||||||
|
: process_block_impl<D + 1>(sprout::next(first), last, args..., *first)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
template<int D = 16, typename Iterator, typename... Args, SPROUT_RECURSIVE_FUNCTION_TEMPLATE_BREAK(D)>
|
||||||
|
SPROUT_CONSTEXPR typename std::enable_if<sizeof...(Args) != 64, sha1 const>::type
|
||||||
|
process_block_impl(Iterator first, Iterator last, Args... args) const {
|
||||||
|
return sprout::throw_recursive_function_template_instantiation_exeeded();
|
||||||
|
}
|
||||||
|
#else
|
||||||
SPROUT_CONSTEXPR sha1 const process(
|
SPROUT_CONSTEXPR sha1 const process(
|
||||||
sprout::array<std::uint32_t, 5> const& h,
|
sprout::array<std::uint32_t, 5> const& h,
|
||||||
sprout::array<std::uint8_t, 64> const& block,
|
sprout::array<std::uint8_t, 64> const& block,
|
||||||
|
@ -68,14 +198,8 @@ namespace sprout {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR sha1 const process_block_2(
|
SPROUT_CONSTEXPR sha1 const process_block_2(
|
||||||
std::uint32_t a,
|
std::uint32_t a, std::uint32_t b, std::uint32_t c, std::uint32_t d, std::uint32_t e,
|
||||||
std::uint32_t b,
|
std::size_t i, std::uint32_t f, std::uint32_t k
|
||||||
std::uint32_t c,
|
|
||||||
std::uint32_t d,
|
|
||||||
std::uint32_t e,
|
|
||||||
std::size_t i,
|
|
||||||
std::uint32_t f,
|
|
||||||
std::uint32_t k
|
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return process_block_1(
|
return process_block_1(
|
||||||
|
@ -88,21 +212,13 @@ namespace sprout {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR sha1 const process_block_1(
|
SPROUT_CONSTEXPR sha1 const process_block_1(
|
||||||
std::uint32_t a,
|
std::uint32_t a, std::uint32_t b, std::uint32_t c, std::uint32_t d, std::uint32_t e,
|
||||||
std::uint32_t b,
|
|
||||||
std::uint32_t c,
|
|
||||||
std::uint32_t d,
|
|
||||||
std::uint32_t e,
|
|
||||||
std::size_t i = 0
|
std::size_t i = 0
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return i < 80
|
return i < 80
|
||||||
? process_block_2(
|
? process_block_2(
|
||||||
a,
|
a, b, c, d, e,
|
||||||
b,
|
|
||||||
c,
|
|
||||||
d,
|
|
||||||
e,
|
|
||||||
i,
|
i,
|
||||||
i < 20 ? (b & c) | (~b & d)
|
i < 20 ? (b & c) | (~b & d)
|
||||||
: i < 40 ? b ^ c ^ d
|
: i < 40 ? b ^ c ^ d
|
||||||
|
@ -126,15 +242,8 @@ namespace sprout {
|
||||||
return process_block_1(h_[0], h_[1], h_[2], h_[3], h_[4]);
|
return process_block_1(h_[0], h_[1], h_[2], h_[3], h_[4]);
|
||||||
}
|
}
|
||||||
template<typename Iterator, typename... Args>
|
template<typename Iterator, typename... Args>
|
||||||
SPROUT_CONSTEXPR typename std::enable_if<
|
SPROUT_CONSTEXPR typename std::enable_if<sizeof...(Args) == 64, sha1 const>::type
|
||||||
sizeof...(Args) == 64,
|
process_block_impl(Iterator first, Iterator last, Args... args) const {
|
||||||
sha1 const
|
|
||||||
>::type process_block_impl(
|
|
||||||
Iterator first,
|
|
||||||
Iterator last,
|
|
||||||
Args... args
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return first == last ? process(
|
return first == last ? process(
|
||||||
h_,
|
h_,
|
||||||
sprout::make_array<std::uint8_t>(args...),
|
sprout::make_array<std::uint8_t>(args...),
|
||||||
|
@ -150,15 +259,8 @@ namespace sprout {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
template<typename Iterator, typename... Args>
|
template<typename Iterator, typename... Args>
|
||||||
SPROUT_CONSTEXPR typename std::enable_if<
|
SPROUT_CONSTEXPR typename std::enable_if<sizeof...(Args) != 64, sha1 const>::type
|
||||||
sizeof...(Args) != 64,
|
process_block_impl(Iterator first, Iterator last, Args... args) const {
|
||||||
sha1 const
|
|
||||||
>::type process_block_impl(
|
|
||||||
Iterator first,
|
|
||||||
Iterator last,
|
|
||||||
Args... args
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
return first == last ? process(
|
return first == last ? process(
|
||||||
h_,
|
h_,
|
||||||
sprout::get_internal(sprout::range::fixed::copy(sprout::make_array<std::uint8_t>(args...), sprout::sub(block_, block_byte_index_))),
|
sprout::get_internal(sprout::range::fixed::copy(sprout::make_array<std::uint8_t>(args...), sprout::sub(block_, block_byte_index_))),
|
||||||
|
@ -174,6 +276,7 @@ namespace sprout {
|
||||||
: process_block_impl(sprout::next(first), last, args..., *first)
|
: process_block_impl(sprout::next(first), last, args..., *first)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
SPROUT_CONSTEXPR sha1 const process_one() const {
|
SPROUT_CONSTEXPR sha1 const process_one() const {
|
||||||
return process(
|
return process(
|
||||||
h_,
|
h_,
|
||||||
|
|
|
@ -26,79 +26,77 @@ namespace sprout {
|
||||||
T re_;
|
T re_;
|
||||||
T im_;
|
T im_;
|
||||||
public:
|
public:
|
||||||
SPROUT_CONSTEXPR complex(T const& re = T(), T const& im = T())
|
SPROUT_CONSTEXPR complex(T const& re = T(), T const& im = T()) SPROUT_NOEXCEPT
|
||||||
: re_(re)
|
: re_(re) , im_(im)
|
||||||
, im_(im)
|
|
||||||
{}
|
{}
|
||||||
SPROUT_CONSTEXPR complex(complex const&) = default;
|
SPROUT_CONSTEXPR complex(complex const&) = default;
|
||||||
template<typename X>
|
template<typename X>
|
||||||
SPROUT_CONSTEXPR complex(complex<X> const& other)
|
SPROUT_CONSTEXPR complex(complex<X> const& other) SPROUT_NOEXCEPT
|
||||||
: re_(other.real())
|
: re_(other.real()) , im_(other.imag())
|
||||||
, im_(other.imag())
|
|
||||||
{}
|
{}
|
||||||
SPROUT_CONSTEXPR T real() const {
|
SPROUT_CONSTEXPR T real() const SPROUT_NOEXCEPT {
|
||||||
return re_;
|
return re_;
|
||||||
}
|
}
|
||||||
void real(T re) {
|
void real(T re) SPROUT_NOEXCEPT {
|
||||||
re_ = re;
|
re_ = re;
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR T imag() const{
|
SPROUT_CONSTEXPR T imag() const SPROUT_NOEXCEPT {
|
||||||
return im_;
|
return im_;
|
||||||
}
|
}
|
||||||
void imag(T im) {
|
void imag(T im) SPROUT_NOEXCEPT {
|
||||||
im_ = im;
|
im_ = im;
|
||||||
}
|
}
|
||||||
complex& operator=(T const& rhs) {
|
complex& operator=(T const& rhs) SPROUT_NOEXCEPT {
|
||||||
re_ = rhs;
|
re_ = rhs;
|
||||||
im_ = T();
|
im_ = T();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
complex& operator+=(T const& rhs) {
|
complex& operator+=(T const& rhs) SPROUT_NOEXCEPT {
|
||||||
re_ += rhs;
|
re_ += rhs;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
complex& operator-=(T const& rhs) {
|
complex& operator-=(T const& rhs) SPROUT_NOEXCEPT {
|
||||||
re_ -= rhs;
|
re_ -= rhs;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
complex& operator*=(T const& rhs) {
|
complex& operator*=(T const& rhs) SPROUT_NOEXCEPT {
|
||||||
re_ *= rhs;
|
re_ *= rhs;
|
||||||
im_ *= rhs;
|
im_ *= rhs;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
complex& operator/=(T const& rhs) {
|
complex& operator/=(T const& rhs) SPROUT_NOEXCEPT {
|
||||||
re_ /= rhs;
|
re_ /= rhs;
|
||||||
im_ /= rhs;
|
im_ /= rhs;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
complex& operator=(complex const&) = default;
|
complex& operator=(complex const&) = default;
|
||||||
template<typename X>
|
template<typename X>
|
||||||
complex& operator=(complex<X> const& rhs) {
|
complex& operator=(complex<X> const& rhs) SPROUT_NOEXCEPT {
|
||||||
re_ = rhs.real();
|
re_ = rhs.real();
|
||||||
im_ = rhs.imag();
|
im_ = rhs.imag();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
template<typename X>
|
template<typename X>
|
||||||
complex& operator+=(complex<X> const& rhs) {
|
complex& operator+=(complex<X> const& rhs) SPROUT_NOEXCEPT {
|
||||||
re_ += rhs.real();
|
re_ += rhs.real();
|
||||||
im_ += rhs.imag();
|
im_ += rhs.imag();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
template<typename X>
|
template<typename X>
|
||||||
complex& operator-=(complex<X> const& rhs) {
|
complex& operator-=(complex<X> const& rhs) SPROUT_NOEXCEPT {
|
||||||
re_ -= rhs.real();
|
re_ -= rhs.real();
|
||||||
im_ -= rhs.imag();
|
im_ -= rhs.imag();
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
template<typename X>
|
template<typename X>
|
||||||
complex& operator*=(complex<X> const& rhs) {
|
complex& operator*=(complex<X> const& rhs) SPROUT_NOEXCEPT {
|
||||||
return *this = complex(
|
return *this = complex(
|
||||||
re_ * rhs.real() - im_ * rhs.imag(),
|
re_ * rhs.real() - im_ * rhs.imag(),
|
||||||
re_ * rhs.imag() + im_ * rhs.real()
|
re_ * rhs.imag() + im_ * rhs.real()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
template<typename X>
|
template<typename X>
|
||||||
complex& operator/=(complex<X> const& rhs) {
|
complex& operator/=(complex<X> const& rhs) SPROUT_NOEXCEPT {
|
||||||
T n = sprout::detail::complex_norm(rhs);
|
T n = sprout::detail::complex_norm(rhs);
|
||||||
return *this = complex(
|
return *this = complex(
|
||||||
(re_ * rhs.real() + im_ * rhs.imag()) / n,
|
(re_ * rhs.real() + im_ * rhs.imag()) / n,
|
||||||
|
|
|
@ -395,7 +395,7 @@ namespace sprout {
|
||||||
struct container_nosy_fixed_size_impl<Container, true> {
|
struct container_nosy_fixed_size_impl<Container, true> {
|
||||||
public:
|
public:
|
||||||
static SPROUT_CONSTEXPR decltype(sprout::detail::container_nosy_static_size<Container>::static_size)
|
static SPROUT_CONSTEXPR decltype(sprout::detail::container_nosy_static_size<Container>::static_size)
|
||||||
fixed_size() {
|
fixed_size() SPROUT_NOEXCEPT {
|
||||||
return sprout::detail::container_nosy_static_size<Container>::static_size;
|
return sprout::detail::container_nosy_static_size<Container>::static_size;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -440,7 +440,7 @@ namespace sprout {
|
||||||
SPROUT_STATIC_CONSTEXPR size_type static_size = N ;
|
SPROUT_STATIC_CONSTEXPR size_type static_size = N ;
|
||||||
public:
|
public:
|
||||||
static SPROUT_CONSTEXPR size_type
|
static SPROUT_CONSTEXPR size_type
|
||||||
fixed_size() {
|
fixed_size() SPROUT_NOEXCEPT {
|
||||||
return static_size;
|
return static_size;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -35,21 +35,17 @@ namespace sprout {
|
||||||
IntType den_;
|
IntType den_;
|
||||||
protected:
|
protected:
|
||||||
SPROUT_CONSTEXPR rational_impl()
|
SPROUT_CONSTEXPR rational_impl()
|
||||||
: num_(0)
|
: num_(0) , den_(1)
|
||||||
, den_(1)
|
|
||||||
{}
|
{}
|
||||||
rational_impl(rational_impl const&) = default;
|
rational_impl(rational_impl const&) = default;
|
||||||
SPROUT_CONSTEXPR rational_impl(param_type n)
|
SPROUT_CONSTEXPR rational_impl(param_type n)
|
||||||
: num_(n)
|
: num_(n) , den_(1)
|
||||||
, den_(1)
|
|
||||||
{}
|
{}
|
||||||
SPROUT_CONSTEXPR rational_impl(param_type n, param_type d)
|
SPROUT_CONSTEXPR rational_impl(param_type n, param_type d)
|
||||||
: num_(n)
|
: num_(n) , den_(d)
|
||||||
, den_(d)
|
|
||||||
{}
|
{}
|
||||||
SPROUT_CONSTEXPR rational_impl(param_type n, param_type d, param_type g)
|
SPROUT_CONSTEXPR rational_impl(param_type n, param_type d, param_type g)
|
||||||
: num_(n / g)
|
: num_(n / g) , den_(d / g)
|
||||||
, den_(d / g)
|
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
@ -86,11 +82,11 @@ namespace sprout {
|
||||||
: base_type(n, d)
|
: base_type(n, d)
|
||||||
{}
|
{}
|
||||||
public:
|
public:
|
||||||
SPROUT_CONSTEXPR rational()
|
SPROUT_CONSTEXPR rational() SPROUT_NOEXCEPT
|
||||||
: base_type()
|
: base_type()
|
||||||
{}
|
{}
|
||||||
rational(rational const&) = default;
|
rational(rational const&) = default;
|
||||||
SPROUT_CONSTEXPR rational(param_type n)
|
SPROUT_CONSTEXPR rational(param_type n) SPROUT_NOEXCEPT
|
||||||
: base_type(n)
|
: base_type(n)
|
||||||
{}
|
{}
|
||||||
SPROUT_CONSTEXPR rational(param_type n, param_type d)
|
SPROUT_CONSTEXPR rational(param_type n, param_type d)
|
||||||
|
@ -98,7 +94,7 @@ namespace sprout {
|
||||||
{}
|
{}
|
||||||
|
|
||||||
rational& operator=(rational const&) = default;
|
rational& operator=(rational const&) = default;
|
||||||
rational& operator=(param_type n) {
|
rational& operator=(param_type n) SPROUT_NOEXCEPT {
|
||||||
return assign(n, 1);
|
return assign(n, 1);
|
||||||
}
|
}
|
||||||
rational& assign(param_type n, param_type d) {
|
rational& assign(param_type n, param_type d) {
|
||||||
|
@ -107,10 +103,10 @@ namespace sprout {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPROUT_CONSTEXPR IntType numerator() const {
|
SPROUT_CONSTEXPR IntType numerator() const SPROUT_NOEXCEPT {
|
||||||
return num_;
|
return num_;
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR IntType denominator() const {
|
SPROUT_CONSTEXPR IntType denominator() const SPROUT_NOEXCEPT {
|
||||||
return den_;
|
return den_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,29 +165,29 @@ namespace sprout {
|
||||||
return *this /= rational(rhs);
|
return *this /= rational(rhs);
|
||||||
}
|
}
|
||||||
|
|
||||||
rational& operator++() {
|
rational& operator++() SPROUT_NOEXCEPT {
|
||||||
num_ += den_;
|
num_ += den_;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
rational& operator--() {
|
rational& operator--() SPROUT_NOEXCEPT {
|
||||||
num_ -= den_;
|
num_ -= den_;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
rational operator++(int) {
|
rational operator++(int) SPROUT_NOEXCEPT {
|
||||||
rational result(*this);
|
rational result(*this);
|
||||||
++*this;
|
++*this;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
rational operator--(int) {
|
rational operator--(int) SPROUT_NOEXCEPT {
|
||||||
rational result(*this);
|
rational result(*this);
|
||||||
--*this;
|
--*this;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
SPROUT_CONSTEXPR bool operator!() const {
|
SPROUT_CONSTEXPR bool operator!() const SPROUT_NOEXCEPT {
|
||||||
return !num_;
|
return !num_;
|
||||||
}
|
}
|
||||||
SPROUT_CONSTEXPR operator bool() const {
|
SPROUT_CONSTEXPR operator bool() const SPROUT_NOEXCEPT {
|
||||||
return num_ != 0;
|
return num_ != 0;
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -33,6 +33,10 @@ namespace sprout {
|
||||||
} // namespace sprout
|
} // namespace sprout
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
#if defined(__clang__)
|
||||||
|
# pragma clang diagnostic push
|
||||||
|
# pragma clang diagnostic ignored "-Wmismatched-tags"
|
||||||
|
#endif
|
||||||
//
|
//
|
||||||
// tuple_size
|
// tuple_size
|
||||||
//
|
//
|
||||||
|
@ -52,6 +56,9 @@ namespace std {
|
||||||
static_assert(I < 16, "tuple_element<>: index out of range");
|
static_assert(I < 16, "tuple_element<>: index out of range");
|
||||||
typedef sprout::uuids::uuid::value_type type;
|
typedef sprout::uuids::uuid::value_type type;
|
||||||
};
|
};
|
||||||
|
#if defined(__clang__)
|
||||||
|
# pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|
||||||
#endif // #ifndef SPROUT_UUID_TUPLE_HPP
|
#endif // #ifndef SPROUT_UUID_TUPLE_HPP
|
||||||
|
|
Loading…
Reference in a new issue