summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/hana/example/tutorial/ext/mpl_vector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/boost/libs/hana/example/tutorial/ext/mpl_vector.cpp')
-rw-r--r--src/boost/libs/hana/example/tutorial/ext/mpl_vector.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/boost/libs/hana/example/tutorial/ext/mpl_vector.cpp b/src/boost/libs/hana/example/tutorial/ext/mpl_vector.cpp
new file mode 100644
index 000000000..2802bafe6
--- /dev/null
+++ b/src/boost/libs/hana/example/tutorial/ext/mpl_vector.cpp
@@ -0,0 +1,40 @@
+// Copyright Louis Dionne 2013-2017
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
+
+#include <boost/hana/equal.hpp>
+#include <boost/hana/front.hpp>
+#include <boost/hana/integral_constant.hpp>
+#include <boost/hana/type.hpp>
+
+#include <boost/mpl/size.hpp>
+#include <boost/mpl/vector.hpp>
+namespace hana = boost::hana;
+namespace mpl = boost::mpl;
+
+
+//! [front]
+#include <boost/hana/ext/boost/mpl/vector.hpp> // bridge header
+
+using Vector = mpl::vector<int, char, float>;
+static_assert(hana::front(Vector{}) == hana::type_c<int>, "");
+//! [front]
+
+
+namespace _ns0 {
+//! [size]
+using Size = mpl::size<Vector>::type;
+static_assert(hana::equal(Size{}, hana::int_c<3>), ""); // breaks!
+//! [size]
+}
+
+
+//! [size-fixed]
+#include <boost/hana/ext/boost/mpl/integral_c.hpp>
+
+using Size = mpl::size<Vector>::type;
+static_assert(hana::equal(Size{}, hana::int_c<3>), "");
+//! [size-fixed]
+
+
+int main() { }