fix trivial constructor declaration

This commit is contained in:
bolero-MURAKAMI 2013-10-29 19:15:52 +09:00
parent 1bce2b4a5b
commit 478c476611
16 changed files with 89 additions and 69 deletions

View file

@ -39,7 +39,7 @@ namespace sprout {
);
}
public:
SPROUT_CONSTEXPR xor8(xor8 const&) = default;
xor8(xor8 const&) = default;
explicit SPROUT_CONSTEXPR xor8(sum_type sum)
: sum_(sum)
{}

View file

@ -36,7 +36,7 @@ namespace sprout {
SPROUT_CONSTEXPR complex(T const& re = T(), T const& im = T()) SPROUT_NOEXCEPT
: re_(re), im_(im)
{}
SPROUT_CONSTEXPR complex(complex const&) = default;
complex(complex const&) = default;
template<typename X>
SPROUT_CONSTEXPR complex(complex<X> const& other) SPROUT_NOEXCEPT
: re_(other.real()), im_(other.imag())
@ -44,66 +44,70 @@ namespace sprout {
SPROUT_CONSTEXPR T real() const SPROUT_NOEXCEPT {
return re_;
}
void real(T re) SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR void real(T re) SPROUT_NOEXCEPT {
re_ = re;
}
SPROUT_CONSTEXPR T imag() const SPROUT_NOEXCEPT {
return im_;
}
void imag(T im) SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR void imag(T im) SPROUT_NOEXCEPT {
im_ = im;
}
complex& operator=(T const& rhs) SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR complex& operator=(T const& rhs) SPROUT_NOEXCEPT {
re_ = rhs;
im_ = T();
return *this;
}
complex& operator+=(T const& rhs) SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR complex& operator+=(T const& rhs) SPROUT_NOEXCEPT {
re_ += rhs;
return *this;
}
complex& operator-=(T const& rhs) SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR complex& operator-=(T const& rhs) SPROUT_NOEXCEPT {
re_ -= rhs;
return *this;
}
complex& operator*=(T const& rhs) SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR complex& operator*=(T const& rhs) SPROUT_NOEXCEPT {
re_ *= rhs;
im_ *= rhs;
return *this;
}
complex& operator/=(T const& rhs) SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR complex& operator/=(T const& rhs) SPROUT_NOEXCEPT {
re_ /= rhs;
im_ /= rhs;
return *this;
}
complex& operator=(complex const&) = default;
template<typename X>
complex& operator=(complex<X> const& rhs) SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR complex& operator=(complex const& rhs) SPROUT_NOEXCEPT {
re_ = rhs.real();
im_ = rhs.imag();
return *this;
}
template<typename X>
complex& operator+=(complex<X> const& rhs) SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR complex& operator=(complex<X> const& rhs) SPROUT_NOEXCEPT {
re_ = rhs.real();
im_ = rhs.imag();
return *this;
}
template<typename X>
SPROUT_CXX14_CONSTEXPR complex& operator+=(complex<X> const& rhs) SPROUT_NOEXCEPT {
re_ += rhs.real();
im_ += rhs.imag();
return *this;
}
template<typename X>
complex& operator-=(complex<X> const& rhs) SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR complex& operator-=(complex<X> const& rhs) SPROUT_NOEXCEPT {
re_ -= rhs.real();
im_ -= rhs.imag();
return *this;
}
template<typename X>
complex& operator*=(complex<X> const& rhs) SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR complex& operator*=(complex<X> const& rhs) SPROUT_NOEXCEPT {
return *this = complex(
re_ * rhs.real() - im_ * rhs.imag(),
re_ * rhs.imag() + im_ * rhs.real()
);
}
template<typename X>
complex& operator/=(complex<X> const& rhs) SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR complex& operator/=(complex<X> const& rhs) SPROUT_NOEXCEPT {
T n = sprout::detail::complex_norm(rhs);
return *this = complex(
(re_ * rhs.real() + im_ * rhs.imag()) / n,

View file

@ -50,7 +50,7 @@ namespace sprout {
explicit SPROUT_CONSTEXPR container_holder(param_type x)
: container(x)
{}
SPROUT_CONSTEXPR container_holder(container_holder const&) = default;
container_holder(container_holder const&) = default;
void swap(container_holder& other)
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(other.container, container)))

View file

@ -62,7 +62,7 @@ namespace sprout {
SPROUT_CONSTEXPR uniform_color()
: color_()
{}
SPROUT_CONSTEXPR uniform_color(uniform_color const&) = default;
uniform_color(uniform_color const&) = default;
explicit SPROUT_CONSTEXPR uniform_color(color_type const& color)
: color_(color)
{}

View file

@ -175,7 +175,7 @@ namespace sprout {
SPROUT_CONSTEXPR whitted_style()
: infinity_color_()
{}
SPROUT_CONSTEXPR whitted_style(whitted_style const&) = default;
whitted_style(whitted_style const&) = default;
explicit SPROUT_CONSTEXPR whitted_style(infinity_color_type const& infinity_color)
: infinity_color_(infinity_color)
{}

View file

@ -222,7 +222,7 @@ namespace sprout {
holder_type val;
item_holder_type next;
private:
SPROUT_CONSTEXPR item(item const&) = default;
item(item const&) = default;
SPROUT_CONSTEXPR item(typename holder_type::argument_type p, item_holder_type const& n)
: val(p)
, next(n)
@ -259,7 +259,6 @@ namespace sprout {
SPROUT_CONSTEXPR item() SPROUT_NOEXCEPT
: val(), next()
{}
SPROUT_CONSTEXPR item(item&&) = default;
SPROUT_CONSTEXPR item(typename holder_type::argument_type p)
: val(p)
, next()
@ -324,7 +323,9 @@ namespace sprout {
p = &(*p)->next;
}
}
SPROUT_CXX14_CONSTEXPR forward_clist(forward_clist&& x) = default;
SPROUT_CXX14_CONSTEXPR forward_clist(forward_clist&& x)
: fst(sprout::move(x.fst))
{}
SPROUT_CXX14_CONSTEXPR forward_clist& operator=(forward_clist&& x) {
fst = sprout::move(x.fst);
return *this;

View file

@ -54,7 +54,7 @@ namespace sprout {
explicit SPROUT_CONSTEXPR back_insert_iterator(param_type x)
: base_type(x)
{}
SPROUT_CONSTEXPR back_insert_iterator(back_insert_iterator const&) = default;
back_insert_iterator(back_insert_iterator const&) = default;
SPROUT_CXX14_CONSTEXPR back_insert_iterator& operator=(typename container_type::value_type const& value) {
container->push_back(value);
return *this;

View file

@ -54,7 +54,7 @@ namespace sprout {
explicit SPROUT_CONSTEXPR front_insert_iterator(param_type x)
: base_type(x)
{}
SPROUT_CONSTEXPR front_insert_iterator(front_insert_iterator const&) = default;
front_insert_iterator(front_insert_iterator const&) = default;
SPROUT_CXX14_CONSTEXPR front_insert_iterator& operator=(typename container_type::value_type const& value) {
container->push_front(value);
return *this;

View file

@ -58,7 +58,7 @@ namespace sprout {
SPROUT_CONSTEXPR insert_iterator(param_type x, iterator pos)
: base_type(x), iter(pos)
{}
SPROUT_CONSTEXPR insert_iterator(insert_iterator const&) = default;
insert_iterator(insert_iterator const&) = default;
SPROUT_CONSTEXPR iterator position() const {
return iter;
}

View file

@ -90,7 +90,7 @@ namespace sprout {
bool init;
holder_type val;
private:
void destroy() SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR void destroy() SPROUT_NOEXCEPT {
init = false;
}
public:
@ -106,7 +106,7 @@ namespace sprout {
, val(v.is_initialized() ? holder_type(*v) : holder_type())
{}
#if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ == 8 && __GNUC_PATCHLEVEL__ <= 1))
SPROUT_CONSTEXPR optional(optional&&) = default;
optional(optional&&) = default;
#else
SPROUT_CONSTEXPR optional(optional&& v)
SPROUT_NOEXCEPT_EXPR(std::is_nothrow_move_constructible<T>::value)
@ -159,15 +159,15 @@ namespace sprout {
, val(v.is_initialized() ? holder_type(sprout::move(optional<U>::get(v))) : holder_type())
{}
// 20.6.4.3, assignment
optional& operator=(sprout::nullopt_t v) SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR optional& operator=(sprout::nullopt_t v) SPROUT_NOEXCEPT {
assign(v);
return *this;
}
optional& operator=(optional const& v) {
SPROUT_CXX14_CONSTEXPR optional& operator=(optional const& v) {
assign(v);
return *this;
}
optional& operator=(optional&& v)
SPROUT_CXX14_CONSTEXPR optional& operator=(optional&& v)
SPROUT_NOEXCEPT_EXPR(std::is_move_constructible<T>::value && std::is_move_assignable<T>::value)
{
assign(sprout::forward<optional>(v));
@ -178,17 +178,17 @@ namespace sprout {
// typename = typename std::enable_if<std::is_constructible<T, U>::value && std::is_assignable<U, T>::value>::type
typename = typename std::enable_if<std::is_constructible<T, U&&>::value>::type
>
optional& operator=(U&& v) {
SPROUT_CXX14_CONSTEXPR optional& operator=(U&& v) {
assign(sprout::forward<U>(v));
return *this;
}
template<typename U>
optional& operator=(optional<U> const& v) {
SPROUT_CXX14_CONSTEXPR optional& operator=(optional<U> const& v) {
assign(v);
return *this;
}
template<typename U>
optional& operator=(optional<U>&& v) {
SPROUT_CXX14_CONSTEXPR optional& operator=(optional<U>&& v) {
assign(sprout::forward<optional<U> >(v));
return *this;
}
@ -197,7 +197,7 @@ namespace sprout {
typename... Args,
typename = typename std::enable_if<is_constructible_args<Args...>::value>::type
>
void emplace(Args&&... args) {
SPROUT_CXX14_CONSTEXPR void emplace(Args&&... args) {
optional temp(sprout::in_place, sprout::forward<Args>(args)...);
temp.swap(*this);
}
@ -205,19 +205,19 @@ namespace sprout {
typename U, typename... Args,
typename = typename std::enable_if<is_constructible_args<std::initializer_list<U>&, Args...>::value>::type
>
void emplace(std::initializer_list<U> il, Args&&... args) {
SPROUT_CXX14_CONSTEXPR void emplace(std::initializer_list<U> il, Args&&... args) {
optional temp(sprout::in_place, il, sprout::forward<Args>(args)...);
temp.swap(*this);
}
void assign(sprout::nullopt_t) SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR void assign(sprout::nullopt_t) SPROUT_NOEXCEPT {
destroy();
}
void assign(optional const& v) {
optional temp(v);
temp.swap(*this);
}
void assign(optional&& v)
SPROUT_CXX14_CONSTEXPR void assign(optional&& v)
SPROUT_NOEXCEPT_EXPR(std::is_move_constructible<T>::value && std::is_move_assignable<T>::value)
{
optional temp(sprout::forward<optional>(v));
@ -228,25 +228,25 @@ namespace sprout {
// typename = typename std::enable_if<std::is_constructible<T, U>::value && std::is_assignable<U, T>::value>::type
typename = typename std::enable_if<std::is_constructible<T, U&&>::value>::type
>
void assign(U&& v) {
SPROUT_CXX14_CONSTEXPR void assign(U&& v) {
optional temp(sprout::forward<U>(v));
temp.swap(*this);
}
template<typename U>
void assign(optional<U> const& v) {
SPROUT_CXX14_CONSTEXPR void assign(optional<U> const& v) {
optional temp(v);
temp.swap(*this);
}
template<typename U>
void assign(optional<U>&& v) {
SPROUT_CXX14_CONSTEXPR void assign(optional<U>&& v) {
optional temp(sprout::forward<optional<U> >(v));
temp.swap(*this);
}
void reset() SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR void reset() SPROUT_NOEXCEPT {
destroy();
}
void reset(sprout::nullopt_t v) SPROUT_NOEXCEPT {
SPROUT_CXX14_CONSTEXPR void reset(sprout::nullopt_t v) SPROUT_NOEXCEPT {
assign(v);
}
template<
@ -254,11 +254,11 @@ namespace sprout {
// typename = typename std::enable_if<std::is_constructible<T, U>::value && std::is_assignable<U, T>::value>::type
typename = typename std::enable_if<std::is_constructible<T, U&&>::value>::type
>
void reset(U&& v) {
SPROUT_CXX14_CONSTEXPR void reset(U&& v) {
assign(sprout::forward<U>(v));
}
// 20.6.4.4, swap
void swap(optional& other)
SPROUT_CXX14_CONSTEXPR void swap(optional& other)
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(sprout::swap(val, other.val)))
{
sprout::swap(init, other.init);
@ -270,7 +270,7 @@ namespace sprout {
val.get_pointer()
;
}
pointer_type operator->() {
SPROUT_CXX14_CONSTEXPR pointer_type operator->() {
return SPROUT_ASSERT(is_initialized()),
val.get_pointer()
;
@ -280,7 +280,7 @@ namespace sprout {
: 0
;
}
pointer_type get_pointer() {
SPROUT_CXX14_CONSTEXPR pointer_type get_pointer() {
return is_initialized() ? val.get_pointer()
: 0
;
@ -288,7 +288,7 @@ namespace sprout {
SPROUT_CONSTEXPR pointer_const_type get_ptr() const {
return get_pointer();
}
pointer_type get_ptr() {
SPROUT_CXX14_CONSTEXPR pointer_type get_ptr() {
return get_pointer();
}
@ -297,7 +297,7 @@ namespace sprout {
: val.get()
;
}
reference_type operator*() {
SPROUT_CXX14_CONSTEXPR reference_type operator*() {
return (SPROUT_ASSERT(is_initialized()), true) ? val.get()
: val.get()
;
@ -305,7 +305,7 @@ namespace sprout {
SPROUT_CONSTEXPR reference_const_type value() const {
return get();
}
reference_type value() {
SPROUT_CXX14_CONSTEXPR reference_type value() {
return get();
}
SPROUT_CONSTEXPR reference_const_type get() const {
@ -313,7 +313,7 @@ namespace sprout {
: (throw sprout::bad_optional_access("optional<>: bad optional access"), val.get())
;
}
reference_type get() {
SPROUT_CXX14_CONSTEXPR reference_type get() {
return is_initialized() ? val.get()
: (throw sprout::bad_optional_access("optional<>: bad optional access"), val.get())
;
@ -322,7 +322,7 @@ namespace sprout {
SPROUT_CONSTEXPR reference_const_type value_or(reference_const_type& v) const {
return get_value_or(v);
}
reference_type value_or(reference_type& v) {
SPROUT_CXX14_CONSTEXPR reference_type value_or(reference_type& v) {
return get_value_or(v);
}
SPROUT_CONSTEXPR reference_const_type get_value_or(reference_const_type& v) const {
@ -330,7 +330,7 @@ namespace sprout {
: v
;
}
reference_type get_value_or(reference_type& v) {
SPROUT_CXX14_CONSTEXPR reference_type get_value_or(reference_type& v) {
return is_initialized() ? val.get()
: v
;
@ -351,7 +351,7 @@ namespace sprout {
// swap
//
template<typename T>
inline void
inline SPROUT_CXX14_CONSTEXPR void
swap(sprout::optional<T>& lhs, sprout::optional<T>& rhs)
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
{

View file

@ -129,8 +129,8 @@ namespace sprout {
SPROUT_CONSTEXPR basic_string_impl()
: elems{}, len()
{}
SPROUT_CONSTEXPR basic_string_impl(basic_string_impl const&) = default;
SPROUT_CONSTEXPR basic_string_impl(basic_string_impl&&) SPROUT_NOEXCEPT = default;
basic_string_impl(basic_string_impl const&) = default;
basic_string_impl(basic_string_impl&&) = default;
template<typename String, sprout::index_t... Indexes>
SPROUT_CONSTEXPR basic_string_impl(
sprout::index_tuple<Indexes...>,
@ -293,8 +293,8 @@ namespace sprout {
}
public:
// construct/copy/destroy:
SPROUT_CONSTEXPR basic_string() = default;
SPROUT_CONSTEXPR basic_string(basic_string const&) = default;
basic_string() = default;
basic_string(basic_string const&) = default;
template<std::size_t N2, typename Enable = typename std::enable_if<(N2 < N)>::type>
SPROUT_CONSTEXPR basic_string(basic_string<T, N2, Traits> const& str)
: impl_type(

View file

@ -115,8 +115,8 @@ namespace sprout {
tuple_impl() = default;
template<typename... UTypes>
explicit SPROUT_CONSTEXPR tuple_impl(UTypes&&...) SPROUT_NOEXCEPT {}
SPROUT_CONSTEXPR tuple_impl(tuple_impl const&) = default;
SPROUT_CONSTEXPR tuple_impl(tuple_impl&&) = default;
tuple_impl(tuple_impl const&) = default;
tuple_impl(tuple_impl&&) = default;
template<typename... UTypes>
SPROUT_CONSTEXPR tuple_impl(tuple_impl<Index, UTypes...> const&) SPROUT_NOEXCEPT {}
template<typename... UTypes>

View file

@ -13,7 +13,6 @@
#include <sprout/config.hpp>
#include <sprout/index_tuple/metafunction.hpp>
#include <sprout/utility/forward.hpp>
#include <sprout/utility/swap.hpp>
#include <sprout/utility/pair/pair_decl.hpp>
#include <sprout/tuple/tuple/tuple.hpp>
#include <sprout/tuple/tuple/get.hpp>

View file

@ -40,8 +40,8 @@ namespace sprout {
: first()
, second()
{}
SPROUT_CONSTEXPR pair(pair const&) = default;
SPROUT_CONSTEXPR pair(pair&&) = default;
pair(pair const&) = default;
pair(pair&&) = default;
SPROUT_CONSTEXPR pair(T1 const& x, T2 const& y)
: first(x)
, second(y)
@ -102,7 +102,11 @@ namespace sprout {
>
SPROUT_CONSTEXPR pair(sprout::tuples::tuple<U, V>&& other);
pair& operator=(pair const& rhs) = default;
SPROUT_CXX14_CONSTEXPR pair& operator=(pair const& rhs) {
first = rhs.first;
second = rhs.second;
return *this;
}
SPROUT_CXX14_CONSTEXPR pair& operator=(pair&& rhs)
SPROUT_NOEXCEPT_EXPR(std::is_nothrow_move_assignable<T1>::value && std::is_nothrow_move_assignable<T2>::value)
{

View file

@ -83,8 +83,12 @@ namespace sprout {
SPROUT_CONSTEXPR basic_string_ref()
: ptr_(0), len_(0)
{}
SPROUT_CONSTEXPR basic_string_ref(basic_string_ref const& rhs) = default;
basic_string_ref& operator=(basic_string_ref const& rhs) = default;
basic_string_ref(basic_string_ref const& rhs) = default;
SPROUT_CXX14_CONSTEXPR basic_string_ref& operator=(basic_string_ref const& rhs) {
basic_string_ref temp(rhs);
temp.swap(*this);
return *this;
}
SPROUT_CONSTEXPR basic_string_ref(const_pointer str)
: ptr_(str), len_(traits_type::length(str))
{}

View file

@ -211,8 +211,8 @@ namespace sprout {
SPROUT_CONSTEXPR value_holder()
: holder_()
{}
SPROUT_CONSTEXPR value_holder(value_holder const&) = default;
SPROUT_CONSTEXPR value_holder(value_holder&&) = default;
value_holder(value_holder const&) = default;
value_holder(value_holder&&) = default;
explicit SPROUT_CONSTEXPR value_holder(argument_type p)
: holder_(helper_type::hold(p))
{}
@ -234,8 +234,16 @@ namespace sprout {
: holder_(il, sprout::forward<Args>(args)...)
{}
value_holder& operator=(value_holder const&) = default;
value_holder& operator=(value_holder&&) = default;
SPROUT_CXX14_CONSTEXPR value_holder& operator=(value_holder const& rhs) {
value_holder temp(rhs);
temp.swap(*this);
return *this;
}
SPROUT_CXX14_CONSTEXPR value_holder& operator=(value_holder&& rhs) {
value_holder temp(sprout::move(rhs));
temp.swap(*this);
return *this;
}
SPROUT_CXX14_CONSTEXPR value_holder& operator=(argument_type p) {
value_holder temp(p);
temp.swap(*this);