]>
Commit | Line | Data |
---|---|---|
b32b8144 | 1 | // Copyright Louis Dionne 2013-2017 |
7c673cae FG |
2 | // Distributed under the Boost Software License, Version 1.0. |
3 | // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) | |
4 | ||
5 | #include <boost/hana/assert.hpp> | |
6 | #include <boost/hana/contains.hpp> | |
7 | #include <boost/hana/drop_while.hpp> | |
8 | #include <boost/hana/integral_constant.hpp> | |
9 | #include <boost/hana/is_empty.hpp> | |
10 | #include <boost/hana/string.hpp> | |
11 | namespace hana = boost::hana; | |
12 | ||
13 | ||
14 | int main() { | |
15 | BOOST_HANA_CONSTANT_CHECK(!hana::is_empty(BOOST_HANA_STRING("abcd"))); | |
16 | BOOST_HANA_CONSTANT_CHECK(hana::is_empty(BOOST_HANA_STRING(""))); | |
17 | ||
18 | BOOST_HANA_CONSTANT_CHECK(BOOST_HANA_STRING("abcd")[hana::size_c<2>] == hana::char_c<'c'>); | |
19 | ||
20 | auto is_vowel = [](auto c) { | |
21 | return c ^hana::in^ BOOST_HANA_STRING("aeiouy"); | |
22 | }; | |
23 | BOOST_HANA_CONSTANT_CHECK( | |
24 | hana::drop_while(BOOST_HANA_STRING("aioubcd"), is_vowel) == BOOST_HANA_STRING("bcd") | |
25 | ); | |
26 | } |