Skip to content

Commit 32c356d

Browse files
committed
adds traits.hpp and buckaroo.lock.json
1 parent 9b4f61f commit 32c356d

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

buckaroo.lock.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"google/gtest": {
3+
"source": {
4+
"url": "https://github.com/google/googletest/archive/ec44c6c1675c25b9827aacd08c02433cccde7780.zip",
5+
"sha256": "bc258fff04a6511e7106a1575bb514a185935041b2c16affb799e0567393ec30",
6+
"subPath": "googletest-ec44c6c1675c25b9827aacd08c02433cccde7780"
7+
},
8+
"buck": {
9+
"url": "https://raw.githubusercontent.com/nikhedonia/googletest/665327f0141d4a4fc4f2496e781dce436d742645/BUCK",
10+
"sha256": "d976069f5b47fd8fc57201f47026a70dee4e47b3141ac23567b8a0c56bf9288c"
11+
}
12+
}
13+
}

neither/include/traits.hpp

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#ifndef NEITHER_TRAITS_HPP
2+
#define NEITHER_TRAITS_HPP
3+
4+
namespace neither {
5+
6+
template<class L, class R>
7+
struct Either;
8+
9+
template<class T>
10+
struct Maybe;
11+
12+
template<class L,class...Xs>
13+
auto isCopyable (L l, Xs...) -> L {
14+
return l;
15+
}
16+
17+
template<class L, class R>
18+
auto ensureEither ( Either<L,R> const& e) -> Either<L,R> {
19+
return e;
20+
}
21+
22+
template<class L, class R>
23+
auto ensureEither ( Either<L,R> && e) -> Either<L,R> {
24+
return e;
25+
}
26+
27+
template<class L, class R>
28+
auto ensureEitherRight ( Either<L,R> const& e, R) -> Either<L, R> {
29+
return e;
30+
}
31+
32+
33+
template<class L, class R>
34+
auto ensureEitherRight ( Either<L,R>&& e, R&&) -> Either<L, R> {
35+
return e;
36+
}
37+
38+
39+
template<class L, class R>
40+
auto ensureEitherLeft ( Either<L,R> const& e, L) -> Either<L, R> {
41+
return e;
42+
}
43+
44+
template<class L, class R>
45+
auto ensureEitherLeft ( Either<L,R>&& e, L&& ) -> Either<L, R> {
46+
return e;
47+
}
48+
49+
50+
template<class T>
51+
auto ensureMaybe ( Maybe<T> const& e) -> Maybe<T> {
52+
return e;
53+
}
54+
55+
}
56+
57+
#endif

0 commit comments

Comments
 (0)