From 1132d08f23b3bb5c514c78174d480592fc9ef712 Mon Sep 17 00:00:00 2001 From: bolero-MURAKAMI Date: Sat, 2 Nov 2013 18:28:18 +0900 Subject: [PATCH] add macro SPROUT_NON_CONSTEXPR --- sprout/bitset/bitset.hpp | 42 ++++---- sprout/bitset/io.hpp | 4 +- sprout/checksum/sha1.hpp | 2 +- sprout/complex/operators.hpp | 4 +- sprout/compressed_pair.hpp | 50 ++++----- sprout/config/suffix.hpp | 5 + sprout/container/container_holder.hpp | 18 ++-- sprout/detail/io/ios_state.hpp | 108 +++++++++---------- sprout/iterator/adjacent_filter_iterator.hpp | 2 +- sprout/iterator/front_insert_iterator.hpp | 2 +- sprout/logic/tribool/io.hpp | 22 ++-- sprout/logic/tribool/tribool.hpp | 2 +- sprout/optional/optional.hpp | 2 +- sprout/random/additive_combine.hpp | 4 +- sprout/random/bernoulli_distribution.hpp | 10 +- sprout/random/binomial_distribution.hpp | 12 +-- sprout/random/geometric_distribution.hpp | 10 +- sprout/random/inversive_congruential.hpp | 4 +- sprout/random/linear_congruential.hpp | 8 +- sprout/random/linear_feedback_shift.hpp | 4 +- sprout/random/mersenne_twister.hpp | 4 +- sprout/random/normal_distribution.hpp | 10 +- sprout/random/random_result.hpp | 2 +- sprout/random/shuffle_order.hpp | 4 +- sprout/random/uniform_01.hpp | 10 +- sprout/random/uniform_int_distribution.hpp | 10 +- sprout/random/uniform_real_distribution.hpp | 10 +- sprout/random/uniform_smallint.hpp | 10 +- sprout/random/xor_combine.hpp | 4 +- sprout/rational/io.hpp | 4 +- sprout/string/io.hpp | 4 +- sprout/string/string.hpp | 6 +- sprout/utility/string_ref/io.hpp | 2 +- sprout/utility/string_ref/string_ref.hpp | 6 +- sprout/uuid/io.hpp | 2 +- sprout/variant/io.hpp | 4 +- sprout/variant/variant.hpp | 6 +- 37 files changed, 209 insertions(+), 204 deletions(-) diff --git a/sprout/bitset/bitset.hpp b/sprout/bitset/bitset.hpp index 02ba0c4c..f6d3dded 100644 --- a/sprout/bitset/bitset.hpp +++ b/sprout/bitset/bitset.hpp @@ -335,7 +335,7 @@ namespace sprout { } SPROUT_CXX14_CONSTEXPR void do_right_shift(std::size_t shift) SPROUT_NOEXCEPT { - if (shift != 0) { + if (shift != 0) { std::size_t const wshift = shift / (CHAR_BIT * sprout::detail::sizeof_::value); std::size_t const offset = shift % (CHAR_BIT * sprout::detail::sizeof_::value); std::size_t const limit = N - wshift - 1; @@ -882,10 +882,10 @@ namespace sprout { inline SPROUT_CONSTEXPR bitset operator^(sprout::bitset const& lhs, sprout::bitset const& rhs) SPROUT_NOEXCEPT; template - inline std::basic_istream& + inline SPROUT_NON_CONSTEXPR std::basic_istream& operator>>(std::basic_istream& lhs, sprout::bitset& rhs); template - inline std::basic_ostream& + inline SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<(std::basic_ostream& lhs, sprout::bitset const& rhs); template @@ -1037,7 +1037,7 @@ namespace sprout { } } template - void + SPROUT_NON_CONSTEXPR void copy_from_string( std::basic_string const& s, std::size_t pos, std::size_t n, Char zero, Char one @@ -1046,7 +1046,7 @@ namespace sprout { copy_from_ptr(s.data(), s.size(), pos, n, zero, one); } template - void + SPROUT_NON_CONSTEXPR void copy_to_string(std::basic_string& s, Char zero, Char one) const { s.assign(N, zero); for (std::size_t i = N; i > 0; --i) { @@ -1056,12 +1056,12 @@ namespace sprout { } } template - void + SPROUT_NON_CONSTEXPR void copy_from_string(std::basic_string const& s, std::size_t pos, std::size_t n) { copy_from_string(s, pos, n, Char('0'), Char('1')); } template - void + SPROUT_NON_CONSTEXPR void copy_to_string(std::basic_string& s) const { copy_to_string(s, Char('0'), Char('1')); } @@ -1076,7 +1076,7 @@ namespace sprout { : base_type(sprout::detail::sanitize_val::do_sanitize_val(val)) {} template - explicit bitset(std::basic_string const& s, std::size_t position = 0) + explicit SPROUT_NON_CONSTEXPR bitset(std::basic_string const& s, std::size_t position = 0) : base_type() { if (position > s.size()) { @@ -1085,7 +1085,7 @@ namespace sprout { copy_from_string(s, position, std::basic_string::npos, Char('0'), Char('1')); } template - bitset(std::basic_string const& s, std::size_t position, std::size_t n) + SPROUT_NON_CONSTEXPR bitset(std::basic_string const& s, std::size_t position, std::size_t n) : base_type() { if (position > s.size()) { @@ -1095,7 +1095,7 @@ namespace sprout { } template - bitset( + SPROUT_NON_CONSTEXPR bitset( std::basic_string const& s, std::size_t position, std::size_t n, Char zero, Char one = Char('1') ) @@ -1107,7 +1107,7 @@ namespace sprout { copy_from_string(s, position, n, zero, one); } template - explicit bitset( + explicit SPROUT_NON_CONSTEXPR bitset( Char const* str, typename std::basic_string::std::size_type n = std::basic_string::npos, Char zero = Char('0'), Char one = Char('1') ) @@ -1248,44 +1248,44 @@ namespace sprout { return this->do_to_ullong(); } template - std::basic_string + SPROUT_NON_CONSTEXPR std::basic_string to_string() const { std::basic_string result; copy_to_string(result, Char('0'), Char('1')); return result; } template - std::basic_string + SPROUT_NON_CONSTEXPR std::basic_string to_string(Char zero, Char one = Char('1')) const { std::basic_string result; copy_to_string(result, zero, one); return result; } template - std::basic_string > + SPROUT_NON_CONSTEXPR std::basic_string > to_string() const { return to_string >(); } template - std::basic_string > + SPROUT_NON_CONSTEXPR std::basic_string > to_string(Char zero, Char one = Char('1')) const { return to_string >(zero, one); } template - std::basic_string, std::allocator > + SPROUT_NON_CONSTEXPR std::basic_string, std::allocator > to_string() const { return to_string, std::allocator >(); } template - std::basic_string, std::allocator > + SPROUT_NON_CONSTEXPR std::basic_string, std::allocator > to_string(Char zero, Char one = Char('1')) const { return to_string, std::allocator >(zero, one); } - std::basic_string, std::allocator > + SPROUT_NON_CONSTEXPR std::basic_string, std::allocator > to_string() const { return to_string, std::allocator >(); } - std::basic_string, std::allocator > + SPROUT_NON_CONSTEXPR std::basic_string, std::allocator > to_string(char zero, char one = '1') const { return to_string, std::allocator >(zero, one); } @@ -1359,10 +1359,10 @@ namespace sprout { friend SPROUT_CONSTEXPR sprout::bitset sprout::operator^(sprout::bitset const& lhs, sprout::bitset const& rhs) SPROUT_NOEXCEPT; template - friend std::basic_istream& + friend SPROUT_NON_CONSTEXPR std::basic_istream& sprout::operator>>(std::basic_istream& lhs, sprout::bitset& rhs); template - friend std::basic_ostream& + friend SPROUT_NON_CONSTEXPR std::basic_ostream& sprout::operator<<(std::basic_ostream& lhs, sprout::bitset const& rhs); template diff --git a/sprout/bitset/io.hpp b/sprout/bitset/io.hpp index a909d1e0..dd19c3f3 100644 --- a/sprout/bitset/io.hpp +++ b/sprout/bitset/io.hpp @@ -18,7 +18,7 @@ namespace sprout { // 20.5.4 bitset operators: template - inline std::basic_istream& + inline SPROUT_NON_CONSTEXPR std::basic_istream& operator>>(std::basic_istream& lhs, sprout::bitset& rhs) { typedef typename Traits::char_type char_type; typedef std::basic_istream istream_type; @@ -66,7 +66,7 @@ namespace sprout { return lhs; } template - inline std::basic_ostream& + inline SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<(std::basic_ostream& lhs, sprout::bitset const& rhs) { std::basic_string tmp; std::ctype const& ct = std::use_facet >(lhs.getloc()); diff --git a/sprout/checksum/sha1.hpp b/sprout/checksum/sha1.hpp index 111a1f91..594c8807 100644 --- a/sprout/checksum/sha1.hpp +++ b/sprout/checksum/sha1.hpp @@ -432,7 +432,7 @@ namespace sprout { } } template - void process_block_impl(InputIterator first, InputIterator last) { + SPROUT_CXX14_CONSTEXPR void process_block_impl(InputIterator first, InputIterator last) { for(; first != last; ++first) { process_byte(*first); } diff --git a/sprout/complex/operators.hpp b/sprout/complex/operators.hpp index 26beaf57..c40cca1b 100644 --- a/sprout/complex/operators.hpp +++ b/sprout/complex/operators.hpp @@ -134,7 +134,7 @@ namespace sprout { return !(lhs == rhs); } template - std::basic_istream& + inline SPROUT_NON_CONSTEXPR std::basic_istream& operator>>(std::basic_istream& lhs, sprout::complex& rhs) { T re, im; Char ch; @@ -161,7 +161,7 @@ namespace sprout { return lhs; } template - std::basic_ostream& + inline SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<(std::basic_ostream& lhs, sprout::complex const& rhs) { return lhs << '(' << rhs.real() << ',' << rhs.imag() << ')'; } diff --git a/sprout/compressed_pair.hpp b/sprout/compressed_pair.hpp index 854713e4..c6115eef 100644 --- a/sprout/compressed_pair.hpp +++ b/sprout/compressed_pair.hpp @@ -70,19 +70,19 @@ namespace sprout { SPROUT_CONSTEXPR compressed_pair_impl(second_param_type y) : second_(y) {} - first_reference first() { + SPROUT_CXX14_CONSTEXPR first_reference first() { return first_; } SPROUT_CONSTEXPR first_const_reference first() const { return first_; } - second_reference second() { + SPROUT_CXX14_CONSTEXPR second_reference second() { return second_; } SPROUT_CONSTEXPR second_const_reference second() const { return second_; } - void swap(compressed_pair_impl& other) + SPROUT_CXX14_CONSTEXPR void swap(compressed_pair_impl& other) SPROUT_NOEXCEPT_EXPR( SPROUT_NOEXCEPT_EXPR(sprout::swap(first_, other.first_)) && SPROUT_NOEXCEPT_EXPR(sprout::swap(second_, other.second_)) @@ -119,19 +119,19 @@ namespace sprout { SPROUT_CONSTEXPR compressed_pair_impl(second_param_type y) : second_(y) {} - first_reference first() { + SPROUT_CXX14_CONSTEXPR first_reference first() { return *this; } SPROUT_CONSTEXPR first_const_reference first() const { return *this; } - second_reference second() { + SPROUT_CXX14_CONSTEXPR second_reference second() { return second_; } SPROUT_CONSTEXPR second_const_reference second() const { return second_; } - void swap(compressed_pair_impl& other) + SPROUT_CXX14_CONSTEXPR void swap(compressed_pair_impl& other) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(second_, other.second_))) { sprout::swap(second_, other.second_); @@ -164,19 +164,19 @@ namespace sprout { SPROUT_CONSTEXPR compressed_pair_impl(second_param_type y) : second_type(y) {} - first_reference first() { + SPROUT_CXX14_CONSTEXPR first_reference first() { return first_; } SPROUT_CONSTEXPR first_const_reference first() const { return first_; } - second_reference second() { + SPROUT_CXX14_CONSTEXPR second_reference second() { return *this; } SPROUT_CONSTEXPR second_const_reference second() const { return *this; } - void swap(compressed_pair_impl& other) + SPROUT_CXX14_CONSTEXPR void swap(compressed_pair_impl& other) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(first_, other.first_))) { sprout::swap(first_, other.first_); @@ -208,19 +208,19 @@ namespace sprout { SPROUT_CONSTEXPR compressed_pair_impl(second_param_type y) : second_type(y) {} - first_reference first() { + SPROUT_CXX14_CONSTEXPR first_reference first() { return *this; } SPROUT_CONSTEXPR first_const_reference first() const { return *this; } - second_reference second() { + SPROUT_CXX14_CONSTEXPR second_reference second() { return *this; } SPROUT_CONSTEXPR second_const_reference second() const { return *this; } - void swap(compressed_pair_impl&) {} + SPROUT_CXX14_CONSTEXPR void swap(compressed_pair_impl&) {} }; template class compressed_pair_impl @@ -247,19 +247,19 @@ namespace sprout { : first_type(x) , second_(x) {} - first_reference first() { + SPROUT_CXX14_CONSTEXPR first_reference first() { return *this; } SPROUT_CONSTEXPR first_const_reference first() const { return *this; } - second_reference second() { + SPROUT_CXX14_CONSTEXPR second_reference second() { return second_; } SPROUT_CONSTEXPR second_const_reference second() const { return second_; } - void swap(compressed_pair_impl&) {} + SPROUT_CXX14_CONSTEXPR void swap(compressed_pair_impl&) {} }; template class compressed_pair_impl @@ -286,19 +286,19 @@ namespace sprout { : first_(x) , second_(x) {} - first_reference first() { + SPROUT_CXX14_CONSTEXPR first_reference first() { return first_; } SPROUT_CONSTEXPR first_const_reference first() const { return first_; } - second_reference second() { + SPROUT_CXX14_CONSTEXPR second_reference second() { return second_; } SPROUT_CONSTEXPR second_const_reference second() const { return second_; } - void swap(compressed_pair_impl& other) + SPROUT_CXX14_CONSTEXPR void swap(compressed_pair_impl& other) SPROUT_NOEXCEPT_EXPR( SPROUT_NOEXCEPT_EXPR(sprout::swap(first_, other.first_)) && SPROUT_NOEXCEPT_EXPR(sprout::swap(second_, other.second_)) @@ -355,19 +355,19 @@ namespace sprout { explicit SPROUT_CONSTEXPR compressed_pair(second_param_type y) : base_type(y) {} - first_reference first() { + SPROUT_CXX14_CONSTEXPR first_reference first() { return base_type::first(); } SPROUT_CONSTEXPR first_const_reference first() const { return base_type::first(); } - second_reference second() { + SPROUT_CXX14_CONSTEXPR second_reference second() { return base_type::second(); } SPROUT_CONSTEXPR second_const_reference second() const { return base_type::second(); } - void swap(compressed_pair& other) { + SPROUT_CXX14_CONSTEXPR void swap(compressed_pair& other) { base_type::swap(other); } }; @@ -410,19 +410,19 @@ namespace sprout { explicit SPROUT_CONSTEXPR compressed_pair(first_param_type x) : base_type(x) {} - first_reference first() { + SPROUT_CXX14_CONSTEXPR first_reference first() { return base_type::first(); } SPROUT_CONSTEXPR first_const_reference first() const { return base_type::first(); } - second_reference second() { + SPROUT_CXX14_CONSTEXPR second_reference second() { return base_type::second(); } SPROUT_CONSTEXPR second_const_reference second() const { return base_type::second(); } - void swap(compressed_pair& other) { + SPROUT_CXX14_CONSTEXPR void swap(compressed_pair& other) { base_type::swap(other); } }; @@ -430,7 +430,7 @@ namespace sprout { // swap // template - inline void + inline SPROUT_CXX14_CONSTEXPR void swap(sprout::compressed_pair& lhs, sprout::compressed_pair& rhs) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) { diff --git a/sprout/config/suffix.hpp b/sprout/config/suffix.hpp index c4f49ef5..c2b78487 100644 --- a/sprout/config/suffix.hpp +++ b/sprout/config/suffix.hpp @@ -49,6 +49,11 @@ # define SPROUT_INITIALIZER_LIST_CONSTEXPR #endif // #ifndef SPROUT_NO_CXX14_INITIALIZER_LIST +// +// SPROUT_NON_CONSTEXPR +// +#define SPROUT_NON_CONSTEXPR + // // SPROUT_DEFAULTED_DEFAULT_CONSTRUCTOR_DECL // SPROUT_DEFAULTED_DESTRUCTOR_DECL diff --git a/sprout/container/container_holder.hpp b/sprout/container/container_holder.hpp index 3764262e..d04ec678 100644 --- a/sprout/container/container_holder.hpp +++ b/sprout/container/container_holder.hpp @@ -52,19 +52,19 @@ namespace sprout { {} container_holder(container_holder const&) = default; - void swap(container_holder& other) + SPROUT_CXX14_CONSTEXPR void swap(container_holder& other) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(other.container, container))) { sprout::swap(other.container, container); } // iterators: - iterator begin() { + SPROUT_CXX14_CONSTEXPR iterator begin() { return sprout::begin(*container); } SPROUT_CONSTEXPR const_iterator begin() const { return sprout::begin(*container); } - iterator end() { + SPROUT_CXX14_CONSTEXPR iterator end() { return sprout::end(*container); } SPROUT_CONSTEXPR const_iterator end() const { @@ -84,20 +84,20 @@ namespace sprout { return sprout::empty(*container); } - param_type get_internal() { + SPROUT_CXX14_CONSTEXPR param_type get_internal() { return *container; } SPROUT_CONSTEXPR const_param_type get_internal() const { return *container; } // element access: - reference operator[](size_type i) { + SPROUT_CXX14_CONSTEXPR reference operator[](size_type i) { return *sprout::next(begin(), i); } SPROUT_CONSTEXPR const_reference operator[](size_type i) const { return *sprout::next(begin(), i); } - reference at(size_type i) { + SPROUT_CXX14_CONSTEXPR reference at(size_type i) { return i < size() ? (*this)[i] : (throw std::out_of_range("container_holder<>: index out of range"), (*this)[i]) ; @@ -107,13 +107,13 @@ namespace sprout { : (throw std::out_of_range("container_holder<>: index out of range"), (*this)[i]) ; } - reference front() { + SPROUT_CXX14_CONSTEXPR reference front() { return *begin(); } SPROUT_CONSTEXPR const_reference front() const { return *begin(); } - reference back() { + SPROUT_CXX14_CONSTEXPR reference back() { return *sprout::next(begin(), size() - 1); } SPROUT_CONSTEXPR const_reference back() const { @@ -125,7 +125,7 @@ namespace sprout { // swap // template - inline void + inline SPROUT_CXX14_CONSTEXPR void swap(sprout::container_holder& lhs, sprout::container_holder& rhs) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) { diff --git a/sprout/detail/io/ios_state.hpp b/sprout/detail/io/ios_state.hpp index 50b7e001..19b76213 100644 --- a/sprout/detail/io/ios_state.hpp +++ b/sprout/detail/io/ios_state.hpp @@ -29,18 +29,18 @@ namespace sprout { private: ios_flags_saver& operator=(ios_flags_saver const&) SPROUT_DELETED_FUNCTION_DECL public: - explicit ios_flags_saver(state_type& s) + explicit SPROUT_NON_CONSTEXPR ios_flags_saver(state_type& s) : s_save_(s) , a_save_(s.flags()) {} - ios_flags_saver(state_type& s, aspect_type const& a) + SPROUT_NON_CONSTEXPR ios_flags_saver(state_type& s, aspect_type const& a) : s_save_(s) , a_save_(s.flags(a)) {} - ~ios_flags_saver() { + SPROUT_NON_CONSTEXPR ~ios_flags_saver() { this->restore(); } - void restore() { + SPROUT_NON_CONSTEXPR void restore() { s_save_.flags(a_save_); } }; @@ -55,18 +55,18 @@ namespace sprout { private: ios_precision_saver& operator=(ios_precision_saver const&) SPROUT_DELETED_FUNCTION_DECL public: - explicit ios_precision_saver(state_type& s) + explicit SPROUT_NON_CONSTEXPR ios_precision_saver(state_type& s) : s_save_(s) - , a_save_(s.precision()) + , a_save_(s.precision()) {} - ios_precision_saver(state_type& s, aspect_type const& a) + SPROUT_NON_CONSTEXPR ios_precision_saver(state_type& s, aspect_type const& a) : s_save_(s) , a_save_(s.precision(a)) {} - ~ios_precision_saver() { + SPROUT_NON_CONSTEXPR ~ios_precision_saver() { this->restore(); } - void restore() { + SPROUT_NON_CONSTEXPR void restore() { s_save_.precision(a_save_); } }; @@ -81,18 +81,18 @@ namespace sprout { private: ios_width_saver& operator=(ios_width_saver const&) SPROUT_DELETED_FUNCTION_DECL public: - explicit ios_width_saver(state_type& s) + explicit SPROUT_NON_CONSTEXPR ios_width_saver(state_type& s) : s_save_(s) , a_save_(s.width()) {} - ios_width_saver(state_type& s, aspect_type const& a) + SPROUT_NON_CONSTEXPR ios_width_saver(state_type& s, aspect_type const& a) : s_save_(s) , a_save_(s.width(a)) {} - ~ios_width_saver() { + SPROUT_NON_CONSTEXPR ~ios_width_saver() { this->restore(); } - void restore() { + SPROUT_NON_CONSTEXPR void restore() { s_save_.width(a_save_); } }; @@ -108,20 +108,20 @@ namespace sprout { private: basic_ios_iostate_saver& operator=(basic_ios_iostate_saver const&) SPROUT_DELETED_FUNCTION_DECL public: - explicit basic_ios_iostate_saver(state_type& s) + explicit SPROUT_NON_CONSTEXPR basic_ios_iostate_saver(state_type& s) : s_save_(s) , a_save_(s.rdstate()) {} - basic_ios_iostate_saver(state_type& s, aspect_type const& a) + SPROUT_NON_CONSTEXPR basic_ios_iostate_saver(state_type& s, aspect_type const& a) : s_save_(s) , a_save_(s.rdstate()) { s.clear(a); } - ~basic_ios_iostate_saver() { + SPROUT_NON_CONSTEXPR ~basic_ios_iostate_saver() { this->restore(); } - void restore() { + SPROUT_NON_CONSTEXPR void restore() { s_save_.clear(a_save_); } }; @@ -137,20 +137,20 @@ namespace sprout { private: basic_ios_exception_saver& operator=(basic_ios_exception_saver const&) SPROUT_DELETED_FUNCTION_DECL public: - explicit basic_ios_exception_saver(state_type& s) + explicit SPROUT_NON_CONSTEXPR basic_ios_exception_saver(state_type& s) : s_save_(s) , a_save_(s.exceptions()) {} - basic_ios_exception_saver(state_type& s, aspect_type const& a) + SPROUT_NON_CONSTEXPR basic_ios_exception_saver(state_type& s, aspect_type const& a) : s_save_(s) , a_save_(s.exceptions()) { s.exceptions(a); } - ~basic_ios_exception_saver() { + SPROUT_NON_CONSTEXPR ~basic_ios_exception_saver() { this->restore(); } - void restore() { + SPROUT_NON_CONSTEXPR void restore() { s_save_.exceptions(a_save_); } }; @@ -166,18 +166,18 @@ namespace sprout { private: basic_ios_tie_saver& operator=(basic_ios_tie_saver const&) SPROUT_DELETED_FUNCTION_DECL public: - explicit basic_ios_tie_saver(state_type& s) + explicit SPROUT_NON_CONSTEXPR basic_ios_tie_saver(state_type& s) : s_save_(s) , a_save_(s.tie()) {} - basic_ios_tie_saver(state_type& s, aspect_type const& a) + SPROUT_NON_CONSTEXPR basic_ios_tie_saver(state_type& s, aspect_type const& a) : s_save_(s) , a_save_(s.tie(a)) {} - ~basic_ios_tie_saver() { + SPROUT_NON_CONSTEXPR ~basic_ios_tie_saver() { this->restore(); } - void restore() { + SPROUT_NON_CONSTEXPR void restore() { s_save_.tie(a_save_); } }; @@ -193,18 +193,18 @@ namespace sprout { private: basic_ios_rdbuf_saver& operator=(basic_ios_rdbuf_saver const&) SPROUT_DELETED_FUNCTION_DECL public: - explicit basic_ios_rdbuf_saver(state_type& s) + explicit SPROUT_NON_CONSTEXPR basic_ios_rdbuf_saver(state_type& s) : s_save_(s) , a_save_(s.rdbuf()) {} - basic_ios_rdbuf_saver(state_type& s, aspect_type const& a) + SPROUT_NON_CONSTEXPR basic_ios_rdbuf_saver(state_type& s, aspect_type const& a) : s_save_(s) , a_save_(s.rdbuf(a)) {} - ~basic_ios_rdbuf_saver() { + SPROUT_NON_CONSTEXPR ~basic_ios_rdbuf_saver() { this->restore(); } - void restore() { + SPROUT_NON_CONSTEXPR void restore() { s_save_.rdbuf(a_save_); } }; @@ -220,18 +220,18 @@ namespace sprout { private: basic_ios_fill_saver& operator=(basic_ios_fill_saver const&) SPROUT_DELETED_FUNCTION_DECL public: - explicit basic_ios_fill_saver(state_type& s) + explicit SPROUT_NON_CONSTEXPR basic_ios_fill_saver(state_type& s) : s_save_(s) , a_save_(s.fill()) {} - basic_ios_fill_saver(state_type& s, aspect_type const& a) + SPROUT_NON_CONSTEXPR basic_ios_fill_saver(state_type& s, aspect_type const& a) : s_save_(s) , a_save_(s.fill(a)) {} - ~basic_ios_fill_saver() { + SPROUT_NON_CONSTEXPR ~basic_ios_fill_saver() { this->restore(); } - void restore() { + SPROUT_NON_CONSTEXPR void restore() { s_save_.fill(a_save_); } }; @@ -247,18 +247,18 @@ namespace sprout { private: basic_ios_locale_saver& operator=(basic_ios_locale_saver const&) SPROUT_DELETED_FUNCTION_DECL public: - explicit basic_ios_locale_saver(state_type& s) + explicit SPROUT_NON_CONSTEXPR basic_ios_locale_saver(state_type& s) : s_save_(s) , a_save_(s.getloc()) {} - basic_ios_locale_saver(state_type& s, aspect_type const& a) + SPROUT_NON_CONSTEXPR basic_ios_locale_saver(state_type& s, aspect_type const& a) : s_save_(s) , a_save_(s.imbue(a)) {} - ~basic_ios_locale_saver() { + SPROUT_NON_CONSTEXPR ~basic_ios_locale_saver() { this->restore(); } - void restore() { + SPROUT_NON_CONSTEXPR void restore() { s_save_.imbue(a_save_); } }; @@ -275,22 +275,22 @@ namespace sprout { private: ios_iword_saver& operator=(ios_iword_saver const&) SPROUT_DELETED_FUNCTION_DECL public: - explicit ios_iword_saver(state_type& s, index_type i) + explicit SPROUT_NON_CONSTEXPR ios_iword_saver(state_type& s, index_type i) : s_save_(s) , a_save_(s.iword(i)) , i_save_(i) {} - ios_iword_saver(state_type& s, index_type i, aspect_type const& a) + SPROUT_NON_CONSTEXPR ios_iword_saver(state_type& s, index_type i, aspect_type const& a) : s_save_(s) , a_save_(s.iword(i)) , i_save_(i) { s.iword(i) = a; } - ~ios_iword_saver() { + SPROUT_NON_CONSTEXPR ~ios_iword_saver() { this->restore(); } - void restore() { + SPROUT_NON_CONSTEXPR void restore() { s_save_.iword(i_save_) = a_save_; } }; @@ -307,22 +307,22 @@ namespace sprout { private: ios_pword_saver& operator=(ios_pword_saver const&) SPROUT_DELETED_FUNCTION_DECL public: - explicit ios_pword_saver(state_type& s, index_type i) + explicit SPROUT_NON_CONSTEXPR ios_pword_saver(state_type& s, index_type i) : s_save_(s) , a_save_(s.pword(i)) , i_save_(i) {} - ios_pword_saver(state_type& s, index_type i, aspect_type const& a) + SPROUT_NON_CONSTEXPR ios_pword_saver(state_type& s, index_type i, aspect_type const& a) : s_save_(s) , a_save_(s.pword(i)) , i_save_(i) { s.pword(i) = a; } - ~ios_pword_saver() { + SPROUT_NON_CONSTEXPR ~ios_pword_saver() { this->restore(); } - void restore() { + SPROUT_NON_CONSTEXPR void restore() { s_save_.pword(i_save_) = a_save_; } }; @@ -338,16 +338,16 @@ namespace sprout { private: ios_base_all_saver& operator=(ios_base_all_saver const&) SPROUT_DELETED_FUNCTION_DECL public: - explicit ios_base_all_saver(state_type& s) + explicit SPROUT_NON_CONSTEXPR ios_base_all_saver(state_type& s) : s_save_(s) , a1_save_(s.flags()) , a2_save_(s.precision()) , a3_save_(s.width()) {} - ~ios_base_all_saver() { + SPROUT_NON_CONSTEXPR ~ios_base_all_saver() { this->restore(); } - void restore() { + SPROUT_NON_CONSTEXPR void restore() { s_save_.width(a3_save_); s_save_.precision(a2_save_); s_save_.flags(a1_save_); @@ -372,7 +372,7 @@ namespace sprout { private: basic_ios_all_saver& operator=(basic_ios_all_saver const&) SPROUT_DELETED_FUNCTION_DECL public: - explicit basic_ios_all_saver(state_type& s) + explicit SPROUT_NON_CONSTEXPR basic_ios_all_saver(state_type& s) : s_save_(s) , a1_save_(s.flags()) , a2_save_(s.precision()) @@ -384,10 +384,10 @@ namespace sprout { , a8_save_(s.fill()) , a9_save_(s.getloc()) {} - ~basic_ios_all_saver() { + SPROUT_NON_CONSTEXPR ~basic_ios_all_saver() { this->restore(); } - void restore() { + SPROUT_NON_CONSTEXPR void restore() { s_save_.imbue(a9_save_); s_save_.fill(a8_save_); s_save_.rdbuf(a7_save_); @@ -412,16 +412,16 @@ namespace sprout { private: ios_all_word_saver& operator=(ios_all_word_saver const&) SPROUT_DELETED_FUNCTION_DECL public: - ios_all_word_saver(state_type& s, index_type i) + SPROUT_NON_CONSTEXPR ios_all_word_saver(state_type& s, index_type i) : s_save_(s) , i_save_(i) , a1_save_(s.iword(i)) , a2_save_(s.pword(i)) {} - ~ios_all_word_saver() { + SPROUT_NON_CONSTEXPR ~ios_all_word_saver() { this->restore(); } - void restore() { + SPROUT_NON_CONSTEXPR void restore() { s_save_.pword(i_save_) = a2_save_; s_save_.iword(i_save_) = a1_save_; } diff --git a/sprout/iterator/adjacent_filter_iterator.hpp b/sprout/iterator/adjacent_filter_iterator.hpp index 6d405d28..de37436f 100644 --- a/sprout/iterator/adjacent_filter_iterator.hpp +++ b/sprout/iterator/adjacent_filter_iterator.hpp @@ -59,7 +59,7 @@ namespace sprout { iterator_type last; Predicate pred; private: - void satisfy_predicate() { + SPROUT_CXX14_CONSTEXPR void satisfy_predicate() { current = sprout::adjacent_find(current, last, pred); } SPROUT_CONSTEXPR adjacent_filter_iterator(Predicate pred, iterator_type it, iterator_type last, private_construct_t) diff --git a/sprout/iterator/front_insert_iterator.hpp b/sprout/iterator/front_insert_iterator.hpp index 51d8c892..bb2ac0ae 100644 --- a/sprout/iterator/front_insert_iterator.hpp +++ b/sprout/iterator/front_insert_iterator.hpp @@ -76,7 +76,7 @@ namespace sprout { return *this; } - void swap(front_insert_iterator& other) + SPROUT_CXX14_CONSTEXPR void swap(front_insert_iterator& other) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(base_type::swap(other))) { base_type::swap(other); diff --git a/sprout/logic/tribool/io.hpp b/sprout/logic/tribool/io.hpp index 0c614d18..8e064146 100644 --- a/sprout/logic/tribool/io.hpp +++ b/sprout/logic/tribool/io.hpp @@ -22,26 +22,26 @@ namespace sprout { // get_default_indeterminate_name // template - inline std::basic_string + inline SPROUT_NON_CONSTEXPR std::basic_string get_default_indeterminate_name(); template<> - inline std::basic_string + inline SPROUT_NON_CONSTEXPR std::basic_string get_default_indeterminate_name() { return "indeterminate"; } template<> - inline std::basic_string + inline SPROUT_NON_CONSTEXPR std::basic_string get_default_indeterminate_name() { return L"indeterminate"; } #if SPROUT_USE_UNICODE_LITERALS template<> - inline std::basic_string + inline SPROUT_NON_CONSTEXPR std::basic_string get_default_indeterminate_name() { return u"indeterminate"; } template<> - inline std::basic_string + inline SPROUT_NON_CONSTEXPR std::basic_string get_default_indeterminate_name() { return U"indeterminate"; } @@ -63,13 +63,13 @@ namespace sprout { private: string_type name_; public: - indeterminate_name() + SPROUT_NON_CONSTEXPR indeterminate_name() : name_(sprout::logic::get_default_indeterminate_name()) {} - explicit indeterminate_name(string_type const& initial_name) + explicit SPROUT_NON_CONSTEXPR indeterminate_name(string_type const& initial_name) : name_(initial_name) {} - string_type name() const { + SPROUT_NON_CONSTEXPR string_type name() const { return name_; } }; @@ -80,7 +80,7 @@ namespace sprout { // operator<< // template - inline std::basic_ostream& + inline SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<(std::basic_ostream& lhs, sprout::logic::tribool rhs) { if (!sprout::logic::indeterminate(rhs)) { lhs << static_cast(rhs); @@ -104,7 +104,7 @@ namespace sprout { return lhs; } template - inline std::basic_ostream& + inline SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<(std::basic_ostream& lhs, sprout::logic::indeterminate_keyword_t) { return lhs << sprout::logic::tribool(indeterminate); } @@ -113,7 +113,7 @@ namespace sprout { // operator>> // template - inline std::basic_istream& + inline SPROUT_NON_CONSTEXPR std::basic_istream& operator>>(std::basic_istream& lhs, sprout::logic::tribool& rhs) { if (lhs.flags() & std::ios_base::boolalpha) { typename std::basic_istream::sentry cerberus(lhs); diff --git a/sprout/logic/tribool/tribool.hpp b/sprout/logic/tribool/tribool.hpp index ab2dafe0..e0bbd659 100644 --- a/sprout/logic/tribool/tribool.hpp +++ b/sprout/logic/tribool/tribool.hpp @@ -29,7 +29,7 @@ namespace sprout { private: struct dummy { public: - void nonnull() {} + SPROUT_CXX14_CONSTEXPR void nonnull() {} }; typedef void (dummy::*safe_bool)(); public: diff --git a/sprout/optional/optional.hpp b/sprout/optional/optional.hpp index a5dadfb0..4d4177b5 100644 --- a/sprout/optional/optional.hpp +++ b/sprout/optional/optional.hpp @@ -213,7 +213,7 @@ namespace sprout { SPROUT_CXX14_CONSTEXPR void assign(sprout::nullopt_t) SPROUT_NOEXCEPT { destroy(); } - void assign(optional const& v) { + SPROUT_CXX14_CONSTEXPR void assign(optional const& v) { optional temp(v); temp.swap(*this); } diff --git a/sprout/random/additive_combine.hpp b/sprout/random/additive_combine.hpp index 36bec930..a65d0e56 100644 --- a/sprout/random/additive_combine.hpp +++ b/sprout/random/additive_combine.hpp @@ -98,7 +98,7 @@ namespace sprout { return !(lhs == rhs); } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, additive_combine_engine& rhs ) @@ -106,7 +106,7 @@ namespace sprout { return lhs >> rhs.mlcg1_ >> std::ws >> rhs.mlcg2_; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, additive_combine_engine const& rhs ) diff --git a/sprout/random/bernoulli_distribution.hpp b/sprout/random/bernoulli_distribution.hpp index 091c8c4c..397ee488 100644 --- a/sprout/random/bernoulli_distribution.hpp +++ b/sprout/random/bernoulli_distribution.hpp @@ -43,7 +43,7 @@ namespace sprout { return p_; } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, param_type& rhs ) @@ -59,7 +59,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, param_type const& rhs ) @@ -109,7 +109,7 @@ namespace sprout { SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(p_); } - void param(param_type const& parm) { + SPROUT_CXX14_CONSTEXPR void param(param_type const& parm) { p_ = parm.p(); } template @@ -120,7 +120,7 @@ namespace sprout { ; } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, bernoulli_distribution& rhs ) @@ -132,7 +132,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, bernoulli_distribution const& rhs ) diff --git a/sprout/random/binomial_distribution.hpp b/sprout/random/binomial_distribution.hpp index 9cc13700..1db6a958 100644 --- a/sprout/random/binomial_distribution.hpp +++ b/sprout/random/binomial_distribution.hpp @@ -102,7 +102,7 @@ namespace sprout { return p_; } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, param_type& rhs ) @@ -120,7 +120,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, param_type const& rhs ) @@ -598,7 +598,7 @@ namespace sprout { generate2(IntType t, Engine const& eng) const { return generate2_0(t, generate(eng)); } - void init() { + SPROUT_CXX14_CONSTEXPR void init() { m_ = init_m(t_, p_); if (use_inversion()) { q_n_ = init_q_n(t_, p_); @@ -643,7 +643,7 @@ namespace sprout { SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(t_, p_); } - void param(param_type const& parm) { + SPROUT_CXX14_CONSTEXPR void param(param_type const& parm) { t_ = parm.t(); p_ = parm.p(); init(); @@ -659,7 +659,7 @@ namespace sprout { ; } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, binomial_distribution& rhs ) @@ -671,7 +671,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, binomial_distribution const& rhs ) diff --git a/sprout/random/geometric_distribution.hpp b/sprout/random/geometric_distribution.hpp index 43ce21bd..f08abeef 100644 --- a/sprout/random/geometric_distribution.hpp +++ b/sprout/random/geometric_distribution.hpp @@ -47,7 +47,7 @@ namespace sprout { return p_; } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, param_type& rhs ) @@ -63,7 +63,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, param_type const& rhs ) @@ -124,7 +124,7 @@ namespace sprout { SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(p_); } - void param(param_type const& parm) { + SPROUT_CXX14_CONSTEXPR void param(param_type const& parm) { p_ = parm.p(); log_1mp_ = init_log_1mp(p_); } @@ -133,7 +133,7 @@ namespace sprout { return generate(eng); } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, geometric_distribution& rhs ) @@ -145,7 +145,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, geometric_distribution const& rhs ) diff --git a/sprout/random/inversive_congruential.hpp b/sprout/random/inversive_congruential.hpp index 9a2987b0..260783b3 100644 --- a/sprout/random/inversive_congruential.hpp +++ b/sprout/random/inversive_congruential.hpp @@ -90,7 +90,7 @@ namespace sprout { return !(lhs == rhs); } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, inversive_congruential_engine& rhs ) @@ -106,7 +106,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, inversive_congruential_engine const& rhs ) diff --git a/sprout/random/linear_congruential.hpp b/sprout/random/linear_congruential.hpp index 3e59e476..e7590526 100644 --- a/sprout/random/linear_congruential.hpp +++ b/sprout/random/linear_congruential.hpp @@ -92,7 +92,7 @@ namespace sprout { return !(lhs == rhs); } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, linear_congruential_engine& rhs ) @@ -108,7 +108,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, linear_congruential_engine const& rhs ) @@ -196,7 +196,7 @@ namespace sprout { return !(lhs == rhs); } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, rand48& rhs ) @@ -204,7 +204,7 @@ namespace sprout { return lhs >> rhs.lcf_; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, rand48 const& rhs ) diff --git a/sprout/random/linear_feedback_shift.hpp b/sprout/random/linear_feedback_shift.hpp index 507502c4..2eb8123c 100644 --- a/sprout/random/linear_feedback_shift.hpp +++ b/sprout/random/linear_feedback_shift.hpp @@ -88,7 +88,7 @@ namespace sprout { return !(lhs == rhs); } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, linear_feedback_shift_engine& rhs ) @@ -96,7 +96,7 @@ namespace sprout { return lhs >> rhs.x_; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, linear_feedback_shift_engine const& rhs ) diff --git a/sprout/random/mersenne_twister.hpp b/sprout/random/mersenne_twister.hpp index a029f96e..5d902efd 100644 --- a/sprout/random/mersenne_twister.hpp +++ b/sprout/random/mersenne_twister.hpp @@ -402,7 +402,7 @@ namespace sprout { return !(lhs == rhs); } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, mersenne_twister_engine& rhs ) @@ -414,7 +414,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, mersenne_twister_engine const& rhs ) diff --git a/sprout/random/normal_distribution.hpp b/sprout/random/normal_distribution.hpp index a12a4f5c..6623a3ac 100644 --- a/sprout/random/normal_distribution.hpp +++ b/sprout/random/normal_distribution.hpp @@ -62,7 +62,7 @@ namespace sprout { return sigma_; } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, param_type& rhs ) @@ -80,7 +80,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, param_type const& rhs ) @@ -200,7 +200,7 @@ namespace sprout { SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(mean_, sigma_); } - void param(param_type const& parm) { + SPROUT_CXX14_CONSTEXPR void param(param_type const& parm) { mean_ = parm.mean(); sigma_ = parm.sigma(); valid_ = false; @@ -210,7 +210,7 @@ namespace sprout { return generate(eng); } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, normal_distribution& rhs ) @@ -230,7 +230,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, normal_distribution const& rhs ) diff --git a/sprout/random/random_result.hpp b/sprout/random/random_result.hpp index 2ca8701a..d554fb7e 100644 --- a/sprout/random/random_result.hpp +++ b/sprout/random/random_result.hpp @@ -259,7 +259,7 @@ namespace sprout { friend SPROUT_CONSTEXPR bool operator!=(random_result const& lhs, random_result const& rhs) SPROUT_NOEXCEPT { return !(lhs == rhs); } - void swap(random_result& other) + SPROUT_CXX14_CONSTEXPR void swap(random_result& other) SPROUT_NOEXCEPT_EXPR( SPROUT_NOEXCEPT_EXPR(sprout::swap(result_, other.result_)) && SPROUT_NOEXCEPT_EXPR(sprout::swap(engine_, other.engine_)) diff --git a/sprout/random/shuffle_order.hpp b/sprout/random/shuffle_order.hpp index e3cd1a11..47af9345 100644 --- a/sprout/random/shuffle_order.hpp +++ b/sprout/random/shuffle_order.hpp @@ -161,7 +161,7 @@ namespace sprout { return !(lhs == rhs); } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, shuffle_order_engine& rhs ) @@ -174,7 +174,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, shuffle_order_engine const& rhs ) diff --git a/sprout/random/uniform_01.hpp b/sprout/random/uniform_01.hpp index af81f34b..8a0ade70 100644 --- a/sprout/random/uniform_01.hpp +++ b/sprout/random/uniform_01.hpp @@ -36,7 +36,7 @@ namespace sprout { typedef uniform_01 distribution_type; public: template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, param_type& ) @@ -44,7 +44,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, param_type const& ) @@ -132,13 +132,13 @@ namespace sprout { SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(); } - void param(param_type const&) {} + SPROUT_CXX14_CONSTEXPR void param(param_type const&) {} template SPROUT_CONSTEXPR sprout::random::random_result operator()(Engine const& eng) const { return generate(eng, eng()); } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, uniform_01& ) @@ -146,7 +146,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, uniform_01 const& ) diff --git a/sprout/random/uniform_int_distribution.hpp b/sprout/random/uniform_int_distribution.hpp index d4ebe7dd..c20c82ca 100644 --- a/sprout/random/uniform_int_distribution.hpp +++ b/sprout/random/uniform_int_distribution.hpp @@ -715,7 +715,7 @@ namespace sprout { return max_; } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, param_type& rhs ) @@ -733,7 +733,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, param_type const& rhs ) @@ -787,7 +787,7 @@ namespace sprout { SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(min_, max_); } - void param(param_type const& parm) { + SPROUT_CXX14_CONSTEXPR void param(param_type const& parm) { min_ = parm.a(); max_ = parm.b(); } @@ -796,7 +796,7 @@ namespace sprout { return generate(sprout::random::detail::generate_uniform_int(eng, min_, max_)); } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, uniform_int_distribution& rhs ) @@ -808,7 +808,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, uniform_int_distribution const& rhs ) diff --git a/sprout/random/uniform_real_distribution.hpp b/sprout/random/uniform_real_distribution.hpp index 1b8a86aa..32443c2c 100644 --- a/sprout/random/uniform_real_distribution.hpp +++ b/sprout/random/uniform_real_distribution.hpp @@ -369,7 +369,7 @@ namespace sprout { return max_; } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, param_type& rhs ) @@ -387,7 +387,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, param_type const& rhs ) @@ -441,7 +441,7 @@ namespace sprout { SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(min_, max_); } - void param(param_type const& parm) { + SPROUT_CXX14_CONSTEXPR void param(param_type const& parm) { min_ = parm.a(); max_ = parm.b(); } @@ -450,7 +450,7 @@ namespace sprout { return generate(sprout::random::detail::generate_uniform_real(eng, min_, max_)); } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, uniform_real_distribution& rhs ) @@ -462,7 +462,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, uniform_real_distribution const& rhs ) diff --git a/sprout/random/uniform_smallint.hpp b/sprout/random/uniform_smallint.hpp index 04d2b013..252d0b8a 100644 --- a/sprout/random/uniform_smallint.hpp +++ b/sprout/random/uniform_smallint.hpp @@ -53,7 +53,7 @@ namespace sprout { return max_; } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, param_type& rhs ) @@ -71,7 +71,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, param_type const& rhs ) @@ -222,7 +222,7 @@ namespace sprout { SPROUT_CONSTEXPR param_type param() const SPROUT_NOEXCEPT { return param_type(min_, max_); } - void param(param_type const& parm) { + SPROUT_CXX14_CONSTEXPR void param(param_type const& parm) { min_ = parm.a(); max_ = parm.b(); } @@ -232,7 +232,7 @@ namespace sprout { return generate(eng, typename std::is_integral::type()); } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, uniform_smallint& rhs ) @@ -244,7 +244,7 @@ namespace sprout { return lhs; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, uniform_smallint const& rhs ) diff --git a/sprout/random/xor_combine.hpp b/sprout/random/xor_combine.hpp index 94b7beed..7a9dd46d 100644 --- a/sprout/random/xor_combine.hpp +++ b/sprout/random/xor_combine.hpp @@ -86,7 +86,7 @@ namespace sprout { return !(lhs == rhs); } template - friend std::basic_istream& operator>>( + friend SPROUT_NON_CONSTEXPR std::basic_istream& operator>>( std::basic_istream& lhs, xor_combine_engine& rhs ) @@ -94,7 +94,7 @@ namespace sprout { return lhs >> rhs.rng1_ >> std::ws >> rhs.rng2_; } template - friend std::basic_ostream& operator<<( + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<( std::basic_ostream& lhs, xor_combine_engine const& rhs ) diff --git a/sprout/rational/io.hpp b/sprout/rational/io.hpp index b3c7f26c..d89ff411 100644 --- a/sprout/rational/io.hpp +++ b/sprout/rational/io.hpp @@ -20,7 +20,7 @@ namespace sprout { // operator<< // template - inline std::basic_istream& + inline SPROUT_NON_CONSTEXPR std::basic_istream& operator>>(std::basic_istream& lhs, sprout::rational& rhs) { IntType n = IntType(0); IntType d = IntType(1); @@ -39,7 +39,7 @@ namespace sprout { return lhs; } template - inline std::basic_ostream& + inline SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<(std::basic_ostream& lhs, sprout::rational const& rhs) { return lhs << rhs.numerator() << Elem('/') << rhs.denominator(); } diff --git a/sprout/string/io.hpp b/sprout/string/io.hpp index 584c9584..e0aa5fc2 100644 --- a/sprout/string/io.hpp +++ b/sprout/string/io.hpp @@ -19,7 +19,7 @@ namespace sprout { // operator<< // template - inline std::basic_istream& + inline SPROUT_NON_CONSTEXPR std::basic_istream& operator>>(std::basic_istream& lhs, sprout::basic_string& rhs) { typedef T elem_type; typedef StreamTraits traits_type; @@ -62,7 +62,7 @@ namespace sprout { return lhs; } template - inline std::basic_ostream& + inline SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<(std::basic_ostream& lhs, sprout::basic_string const& rhs) { return lhs << rhs.c_str(); } diff --git a/sprout/string/string.hpp b/sprout/string/string.hpp index a821181e..a2709a2e 100644 --- a/sprout/string/string.hpp +++ b/sprout/string/string.hpp @@ -267,7 +267,7 @@ namespace sprout { static SPROUT_CONSTEXPR basic_string from_c_str(T const* s) { return basic_string(s); } - static SPROUT_CONSTEXPR basic_string from_c_str(std::basic_string const& s) { + static SPROUT_NON_CONSTEXPR basic_string from_c_str(std::basic_string const& s) { return from_c_str(s.data(), s.size()); } private: @@ -759,7 +759,7 @@ namespace sprout { } // conversions: template - SPROUT_EXPLICIT_CONVERSION operator std::basic_string() const { + SPROUT_EXPLICIT_CONVERSION SPROUT_NON_CONSTEXPR operator std::basic_string() const { return std::basic_string(data(), size()); } @@ -1022,7 +1022,7 @@ namespace sprout { return sprout::basic_string::from_c_str(s); } template - inline SPROUT_CONSTEXPR sprout::basic_string + inline SPROUT_NON_CONSTEXPR sprout::basic_string string_from_c_str(std::basic_string const& s) { return sprout::basic_string::from_c_str(s); } diff --git a/sprout/utility/string_ref/io.hpp b/sprout/utility/string_ref/io.hpp index dec060e5..2d657793 100644 --- a/sprout/utility/string_ref/io.hpp +++ b/sprout/utility/string_ref/io.hpp @@ -19,7 +19,7 @@ namespace sprout { // operator<< // template - inline std::basic_ostream& + inline SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<(std::basic_ostream& lhs, sprout::basic_string_ref const& rhs) { sprout::copy(rhs.begin(), rhs.end(), std::ostreambuf_iterator(lhs)); return lhs; diff --git a/sprout/utility/string_ref/string_ref.hpp b/sprout/utility/string_ref/string_ref.hpp index c402b2ad..8256290d 100644 --- a/sprout/utility/string_ref/string_ref.hpp +++ b/sprout/utility/string_ref/string_ref.hpp @@ -97,7 +97,7 @@ namespace sprout { : ptr_(str.data()), len_(str.size()) {} template - SPROUT_CONSTEXPR basic_string_ref(std::basic_string const& str) + SPROUT_NON_CONSTEXPR basic_string_ref(std::basic_string const& str) : ptr_(str.data()), len_(str.size()) {} SPROUT_CONSTEXPR basic_string_ref(const_pointer str, size_type len) @@ -411,7 +411,7 @@ namespace sprout { } // others: template - SPROUT_EXPLICIT_CONVERSION operator std::basic_string() const { + SPROUT_EXPLICIT_CONVERSION SPROUT_NON_CONSTEXPR operator std::basic_string() const { return std::basic_string(data(), size()); } SPROUT_CONSTEXPR const_pointer @@ -584,7 +584,7 @@ namespace sprout { return sprout::basic_string_ref(s); } template - inline SPROUT_CONSTEXPR sprout::basic_string_ref + inline SPROUT_NON_CONSTEXPR sprout::basic_string_ref to_string_ref(std::basic_string const& s) { return sprout::basic_string_ref(s); } diff --git a/sprout/uuid/io.hpp b/sprout/uuid/io.hpp index bfc9eccd..5e33f758 100644 --- a/sprout/uuid/io.hpp +++ b/sprout/uuid/io.hpp @@ -82,7 +82,7 @@ namespace sprout { // operator<< // template - inline std::basic_ostream& + inline SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<(std::basic_ostream& lhs, sprout::uuids::uuid const& rhs) { sprout::detail::io::ios_flags_saver flags_saver(lhs); sprout::detail::io::basic_ios_fill_saver fill_saver(lhs); diff --git a/sprout/variant/io.hpp b/sprout/variant/io.hpp index 2e555669..d0fb5584 100644 --- a/sprout/variant/io.hpp +++ b/sprout/variant/io.hpp @@ -27,7 +27,7 @@ namespace sprout { : out_(out) {} template - void operator()(T const& operand) const { + SPROUT_CXX14_CONSTEXPR void operator()(T const& operand) const { out_ << operand; } }; @@ -36,7 +36,7 @@ namespace sprout { // operator<< // template - inline std::basic_ostream& + inline SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<(std::basic_ostream& lhs, sprout::variant const& rhs) { sprout::detail::variant_output_visitor > visitor(lhs); rhs.apply_visitor(visitor); diff --git a/sprout/variant/variant.hpp b/sprout/variant/variant.hpp index d310f800..26fa58f1 100644 --- a/sprout/variant/variant.hpp +++ b/sprout/variant/variant.hpp @@ -187,14 +187,14 @@ namespace sprout { ; } template - static typename std::enable_if< + static SPROUT_NON_CONSTEXPR typename std::enable_if< static_cast(I) == sizeof...(Types), std::basic_ostream& >::type output(std::basic_ostream& os, tuple_type const&, int) { return os; } template - static typename std::enable_if< + static SPROUT_NON_CONSTEXPR typename std::enable_if< static_cast(I) != sizeof...(Types), std::basic_ostream& >::type output(std::basic_ostream& os, tuple_type const& t, int which) { @@ -288,7 +288,7 @@ namespace sprout { } template - friend std::basic_ostream& operator<<(std::basic_ostream& lhs, variant const& rhs) { + friend SPROUT_NON_CONSTEXPR std::basic_ostream& operator<<(std::basic_ostream& lhs, variant const& rhs) { return output<0>(lhs, rhs.tuple_, rhs.which_); } // get support