mirror of
https://github.com/boostorg/date_time.git
synced 2026-01-19 04:12:07 +00:00
Inline friend function definitions for exported/imported classes must become declarations and inline definitions outside the class for Embarcadero C++ clang-based compilers. This bug has been reported to Embarcadero.
This commit is contained in:
@@ -130,6 +130,9 @@ namespace date_time {
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
BOOST_CXX14_CONSTEXPR friend date_type operator+(const date_type& d, const months_type& m)
|
||||
{
|
||||
return d + m.get_offset(d);
|
||||
@@ -149,10 +152,42 @@ namespace date_time {
|
||||
return d += m.get_neg_offset(d);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
BOOST_CXX14_CONSTEXPR friend date_type operator+(const date_type& d, const months_type& m);
|
||||
BOOST_CXX14_CONSTEXPR friend date_type operator+=(date_type& d, const months_type& m);
|
||||
BOOST_CXX14_CONSTEXPR friend date_type operator-(const date_type& d, const months_type& m);
|
||||
BOOST_CXX14_CONSTEXPR friend date_type operator-=(date_type& d, const months_type& m);
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
int_rep _m;
|
||||
};
|
||||
|
||||
#if defined(BOOST_EMBTC)
|
||||
|
||||
inline BOOST_CXX14_CONSTEXPR date_type operator+(const date_type& d, const months_type& m)
|
||||
{
|
||||
return d + m.get_offset(d);
|
||||
}
|
||||
inline BOOST_CXX14_CONSTEXPR date_type operator+=(date_type& d, const months_type& m)
|
||||
{
|
||||
return d += m.get_offset(d);
|
||||
}
|
||||
inline BOOST_CXX14_CONSTEXPR date_type operator-(const date_type& d, const months_type& m)
|
||||
{
|
||||
// get_neg_offset returns a negative duration, so we add
|
||||
return d + m.get_neg_offset(d);
|
||||
}
|
||||
inline BOOST_CXX14_CONSTEXPR date_type operator-=(date_type& d, const months_type& m)
|
||||
{
|
||||
// get_neg_offset returns a negative duration, so we add
|
||||
return d += m.get_neg_offset(d);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//! additional duration type that represents a logical year
|
||||
/*! A logical year enables things like: "date(2002,Mar,2) + years(2) ->
|
||||
* 2004-Mar-2". If the date is a last day-of-the-month, the result will
|
||||
@@ -242,6 +277,9 @@ namespace date_time {
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
BOOST_CXX14_CONSTEXPR friend date_type operator+(const date_type& d, const years_type& y)
|
||||
{
|
||||
return d + y.get_offset(d);
|
||||
@@ -261,10 +299,42 @@ namespace date_time {
|
||||
return d += y.get_neg_offset(d);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
BOOST_CXX14_CONSTEXPR friend date_type operator+(const date_type& d, const years_type& y);
|
||||
BOOST_CXX14_CONSTEXPR friend date_type operator+=(date_type& d, const years_type& y);
|
||||
BOOST_CXX14_CONSTEXPR friend date_type operator-(const date_type& d, const years_type& y);
|
||||
BOOST_CXX14_CONSTEXPR friend date_type operator-=(date_type& d, const years_type& y);
|
||||
|
||||
#endif
|
||||
|
||||
private:
|
||||
int_rep _y;
|
||||
};
|
||||
|
||||
#if defined(BOOST_EMBTC)
|
||||
|
||||
inline BOOST_CXX14_CONSTEXPR date_type operator+(const date_type& d, const years_type& y)
|
||||
{
|
||||
return d + y.get_offset(d);
|
||||
}
|
||||
inline BOOST_CXX14_CONSTEXPR date_type operator+=(date_type& d, const years_type& y)
|
||||
{
|
||||
return d += y.get_offset(d);
|
||||
}
|
||||
inline BOOST_CXX14_CONSTEXPR date_type operator-(const date_type& d, const years_type& y)
|
||||
{
|
||||
// get_neg_offset returns a negative duration, so we add
|
||||
return d + y.get_neg_offset(d);
|
||||
}
|
||||
inline BOOST_CXX14_CONSTEXPR date_type operator-=(date_type& d, const years_type& y)
|
||||
{
|
||||
// get_neg_offset returns a negative duration, so we add
|
||||
return d += y.get_neg_offset(d);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}} // namespace boost::date_time
|
||||
|
||||
#endif // DATE_DURATION_TYPES_HPP___
|
||||
|
||||
@@ -84,6 +84,9 @@ namespace gregorian {
|
||||
base_type::operator-= (rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
BOOST_CXX14_CONSTEXPR friend
|
||||
date_duration operator- (date_duration rhs, date_duration const& lhs)
|
||||
{
|
||||
@@ -91,12 +94,22 @@ namespace gregorian {
|
||||
return rhs;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
BOOST_CXX14_CONSTEXPR friend
|
||||
date_duration operator- (date_duration rhs, date_duration const& lhs);
|
||||
|
||||
#endif
|
||||
|
||||
//! Add a duration -- result is signed
|
||||
BOOST_CXX14_CONSTEXPR date_duration& operator+= (const date_duration& rhs)
|
||||
{
|
||||
base_type::operator+= (rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
BOOST_CXX14_CONSTEXPR friend
|
||||
date_duration operator+ (date_duration rhs, date_duration const& lhs)
|
||||
{
|
||||
@@ -104,6 +117,13 @@ namespace gregorian {
|
||||
return rhs;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
BOOST_CXX14_CONSTEXPR friend
|
||||
date_duration operator+ (date_duration rhs, date_duration const& lhs);
|
||||
|
||||
#endif
|
||||
|
||||
//! unary- Allows for dd = -date_duration(2); -> dd == -2
|
||||
BOOST_CXX14_CONSTEXPR date_duration operator- ()const
|
||||
{
|
||||
@@ -116,12 +136,21 @@ namespace gregorian {
|
||||
base_type::operator/= (divisor);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#if !defined(BOOST_EMBTC)
|
||||
|
||||
BOOST_CXX14_CONSTEXPR friend date_duration operator/ (date_duration rhs, int lhs)
|
||||
{
|
||||
rhs /= lhs;
|
||||
return rhs;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
BOOST_CXX14_CONSTEXPR friend date_duration operator/ (date_duration rhs, int lhs);
|
||||
|
||||
#endif
|
||||
|
||||
//! Returns the smallest duration -- used by to calculate 'end'
|
||||
static BOOST_CXX14_CONSTEXPR date_duration unit()
|
||||
{
|
||||
@@ -129,6 +158,30 @@ namespace gregorian {
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(BOOST_EMBTC)
|
||||
|
||||
inline BOOST_CXX14_CONSTEXPR
|
||||
date_duration operator- (date_duration rhs, date_duration const& lhs)
|
||||
{
|
||||
rhs -= lhs;
|
||||
return rhs;
|
||||
}
|
||||
|
||||
inline BOOST_CXX14_CONSTEXPR
|
||||
date_duration operator+ (date_duration rhs, date_duration const& lhs)
|
||||
{
|
||||
rhs += lhs;
|
||||
return rhs;
|
||||
}
|
||||
|
||||
inline BOOST_CXX14_CONSTEXPR date_duration operator/ (date_duration rhs, int lhs)
|
||||
{
|
||||
rhs /= lhs;
|
||||
return rhs;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//! Shorthand for date_duration
|
||||
typedef date_duration days;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user