Skip to content

Updated from fork#1

Open
e-schumann wants to merge 35 commits intoe-schumann:masterfrom
LoopPerfect:master
Open

Updated from fork#1
e-schumann wants to merge 35 commits intoe-schumann:masterfrom
LoopPerfect:master

Conversation

@e-schumann
Copy link
Copy Markdown
Owner

No description provided.

njlr and others added 30 commits October 24, 2018 17:28
RIP CodeSponsor 💀
Avoiding the implicit conversion from uint to bool and more clearly
expressing the code intentions.

Also remove the unnecessary initialization to false, because all
constructor overloads already do it.
Added neither::maybe::size that is compatible with std::vector::size

constexpr maybe::size_type maybe::size() const noexcept

See: http://www.cplusplus.com/reference/vector/vector/size
Added neither::maybe::empty that is compatible with std::vector::empty

constexpr bool maybe::empty() const noexcept

See: http://www.cplusplus.com/reference/vector/vector/empty
Feature: Add Maybe#size() and Maybe#empty() compatible with STL containers
Feature: Add Maybe#size() and Maybe#empty() compatible with STL containers
That is an instance of type Maybe<void>, used to represent the absence
of a value.

Additionally, added support for operator== and operator!= for
Maybe<void>, hence none, with the semantics:

Maybe<void> x;
Maybe<void> y;

x == y => true
x != y => false

Given that it doesn't hold a value.

Therefore, none will be always equal to itself.
Maybe: Add static const object none
chore: make equals simpler
Replace uniform initialization with copy construction
Compilation of maybe.hpp with g++ 7.3 results in the following warning being
emmitted (here with -Werror enabled):

neither/maybe.hpp:112:8: error: ‘bool neither::{anonymous}::equal(const neither::Maybe<void>&, const neither::Maybe<void>&)’ defined but not used [-Werror=unused-function]
   bool equal(Maybe<void> const&, Maybe<void> const&) {
When `rightMap` is applied to `Either` containing non-copyable type instance,
such as `std::unique_ptr<T>`, then the compiler will hard fail trying to
deduce types (`rightMap &&` should be picked) because there is `(R2)` cast
applied to `std::move` argument, thus forcing copy construction.

`leftMap` works because it does not have such cast.
Remove copy construction from argument to std::move in rightMap &&
 * Adds Travis build matrix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants