Reworked span to match GSL design.

This commit is contained in:
Neil MacIntosh committed 2015-11-29 19:19:37 -08:00
1 parent 38eaf9fc95
commit 0cf947db77
7 files changed
+3302 -2583

No files matched your search

+2 -2
View File
@@ -55,9 +55,9 @@ struct fail_fast : public std::runtime_error
}
#define Expects(cond) if (!(cond)) \
throw gsl::fail_fast("GSL: Precondition failure at " __FILE__ GSL_STRINGIFY(__LINE__));
throw gsl::fail_fast("GSL: Precondition failure at " __FILE__ ": " GSL_STRINGIFY(__LINE__));
#define Ensures(cond) if (!(cond)) \
throw gsl::fail_fast("GSL: Postcondition failure at " __FILE__ GSL_STRINGIFY(__LINE__));
throw gsl::fail_fast("GSL: Postcondition failure at " __FILE__ ": " GSL_STRINGIFY(__LINE__));
#elif defined(GSL_TERMINATE_ON_CONTRACT_VIOLATION)
+4 -4
View File
@@ -76,23 +76,23 @@ private:
// finally() - convenience function to generate a final_act
template <class F>
final_act<F> finally(const F &f)
inline final_act<F> finally(const F &f)
noexcept { return final_act<F>(f); }
template <class F>
final_act<F> finally(F &&f) noexcept
inline final_act<F> finally(F &&f) noexcept
{ return final_act<F>(std::forward<F>(f)); }
// narrow_cast(): a searchable way to do narrowing casts of values
template<class T, class U>
constexpr T narrow_cast(U u) noexcept
inline constexpr T narrow_cast(U u) noexcept
{ return static_cast<T>(u); }
struct narrowing_error : public std::exception {};
// narrow() : a checked version of narrow_cast() that throws if the cast changed the value
template<class T, class U>
T narrow(U u)
inline T narrow(U u)
{ T t = narrow_cast<T>(u); if (static_cast<U>(t) != u) throw narrowing_error(); return t; }
//
+968 -845
View File
File diff suppressed because it is too large. Load diff