-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[string] Add a model of the Monoid concept
Fixes #117
- Loading branch information
Showing
7 changed files
with
127 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright Louis Dionne 2013-2016 | ||
// 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/assert.hpp> | ||
#include <boost/hana/equal.hpp> | ||
#include <boost/hana/plus.hpp> | ||
#include <boost/hana/string.hpp> | ||
namespace hana = boost::hana; | ||
|
||
|
||
auto hello_world = BOOST_HANA_STRING("Hello ") + BOOST_HANA_STRING("world!"); | ||
BOOST_HANA_CONSTANT_CHECK(hello_world == BOOST_HANA_STRING("Hello world!")); | ||
|
||
int main() { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright Louis Dionne 2013-2016 | ||
// 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/assert.hpp> | ||
#include <boost/hana/equal.hpp> | ||
#include <boost/hana/plus.hpp> | ||
#include <boost/hana/string.hpp> | ||
namespace hana = boost::hana; | ||
|
||
|
||
int main() { | ||
BOOST_HANA_CONSTANT_CHECK(hana::equal( | ||
hana::plus(BOOST_HANA_STRING(""), BOOST_HANA_STRING("")), | ||
BOOST_HANA_STRING("") | ||
)); | ||
BOOST_HANA_CONSTANT_CHECK(hana::equal( | ||
hana::plus(BOOST_HANA_STRING("abcd"), BOOST_HANA_STRING("")), | ||
BOOST_HANA_STRING("abcd") | ||
)); | ||
BOOST_HANA_CONSTANT_CHECK(hana::equal( | ||
hana::plus(BOOST_HANA_STRING(""), BOOST_HANA_STRING("abcd")), | ||
BOOST_HANA_STRING("abcd") | ||
)); | ||
BOOST_HANA_CONSTANT_CHECK(hana::equal( | ||
hana::plus(BOOST_HANA_STRING("abcd"), BOOST_HANA_STRING("efg")), | ||
BOOST_HANA_STRING("abcdefg") | ||
)); | ||
|
||
// check operator | ||
BOOST_HANA_CONSTANT_CHECK(hana::equal( | ||
BOOST_HANA_STRING("abc") + BOOST_HANA_STRING("def"), | ||
BOOST_HANA_STRING("abcdef") | ||
)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright Louis Dionne 2013-2016 | ||
// 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/assert.hpp> | ||
#include <boost/hana/equal.hpp> | ||
#include <boost/hana/string.hpp> | ||
#include <boost/hana/zero.hpp> | ||
namespace hana = boost::hana; | ||
|
||
|
||
int main() { | ||
BOOST_HANA_CONSTANT_CHECK(hana::equal( | ||
hana::zero<hana::string_tag>(), | ||
BOOST_HANA_STRING("") | ||
)); | ||
} |
7a3e048
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍