lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master cb353f7b 4/9: Assert that a type is not defau


From: Greg Chicares
Subject: [lmi-commits] [lmi] master cb353f7b 4/9: Assert that a type is not default constructible
Date: Fri, 29 Jul 2022 20:42:33 -0400 (EDT)

branch: master
commit cb353f7b95b2df30aac6487dee466610ffaa4c6d
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>

    Assert that a type is not default constructible
    
    C++ had no static assertion when this was originally written.
---
 value_cast_test.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/value_cast_test.cpp b/value_cast_test.cpp
index 3f529b73..3ab28e5e 100644
--- a/value_cast_test.cpp
+++ b/value_cast_test.cpp
@@ -35,12 +35,14 @@
 #include <istream>
 #include <limits>
 #include <ostream>
+#include <type_traits>
 
 class NotDefaultConstructible
 {
   public:
     NotDefaultConstructible(std::istream const&) {}
 };
+static_assert(!std::is_default_constructible_v<NotDefaultConstructible>);
 
 struct X {std::string s;};
 std::istream& operator>>(std::istream& is, X&       x) {is >> x.s; return is;}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]