Skip to content

Commit

Permalink
Merge pull request #44 from brunocodutra/develop
Browse files Browse the repository at this point in the history
Bump to 0.3.1
  • Loading branch information
brunocodutra authored Sep 4, 2016
2 parents cd30e08 + 7b088fd commit 0d2cbf3
Show file tree
Hide file tree
Showing 32 changed files with 1,039 additions and 283 deletions.
20 changes: 17 additions & 3 deletions doc/css/metal.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,22 @@ html, body {
h1:hover > a.anchor:after,
h2:hover > a.anchor:after,
h3:hover > a.anchor:after {
content: "§";
content: "";
position: absolute;
width: 1em;
left: -1em;
top: 65px;
height: 1.1em;
width: 100%;
cursor: pointer;
}

@media (max-width: 767px) {
h1:hover > a.anchor:after,
h2:hover > a.anchor:after,
h3:hover > a.anchor:after {
top: 120px;
}
}

.page-header + .sub-page-header {
margin-top: -15px;
}
Expand All @@ -120,6 +128,12 @@ a.anchor {
top: -65px;
}

@media (max-width: 767px) {
a.anchor {
top: -120px;
}
}

a:focus {
outline: none;
}
Expand Down
8 changes: 4 additions & 4 deletions example/src/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@

HIDE(
/// [list1]
using list = metal::list<>; // an empty list
using l = metal::list<>; // an empty list
/// [list1]

IS_SAME(metal::is_list<list>, metal::true_);
IS_SAME(metal::is_list<l>, metal::true_);
)

HIDE(
/// [list2]
using list = metal::list<int, int*, int&>;
using l = metal::list<int, int*, int&>;
/// [list2]

IS_SAME(metal::is_list<list>, metal::true_);
IS_SAME(metal::is_list<l>, metal::true_);
)
107 changes: 99 additions & 8 deletions example/src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@

HIDE(
/// [map1]
using map = metal::list<>; // an empty map
using m = metal::list<>; // an empty map
/// [map1]

IS_SAME(metal::is_map<map>, metal::true_);
IS_SAME(metal::is_map<m>, metal::true_);
)

HIDE(
/// [map2]
using map = metal::list<
using m = metal::list<
metal::list<int, long>,
metal::list<float, double>
>;
/// [map2]

IS_SAME(metal::is_map<map>, metal::true_);
IS_SAME(metal::is_map<m>, metal::true_);
)

HIDE(
Expand All @@ -47,28 +47,119 @@ using not_a_map = metal::list< // not a list of pairs
IS_SAME(metal::is_map<not_a_map>, metal::false_);
)

HIDE(
/// [is_map]
using m = metal::map<
metal::pair<int, metal::number<sizeof(int)>>,
metal::pair<char, metal::number<sizeof(char)>>,
metal::pair<float, metal::number<sizeof(float)>>
>;

IS_SAME(metal::is_map<m>, metal::true_);
IS_SAME(metal::is_map<metal::list<>>, metal::true_);
IS_SAME(metal::is_map<metal::list<int, int*>>, metal::false_);
/// [is_map]
)

HIDE(
/// [order]
using m = metal::map<
metal::pair<int, metal::number<sizeof(int)>>,
metal::pair<char, metal::number<sizeof(char)>>,
metal::pair<float, metal::number<sizeof(float)>>
>;

IS_SAME(metal::order<m, int>, metal::number<0>);
IS_SAME(metal::order<m, char>, metal::number<1>);
IS_SAME(metal::order<m, float>, metal::number<2>);
/// [order]
)

HIDE(
/// [has_key]
using m = metal::map<
metal::pair<int, metal::number<sizeof(int)>>,
metal::pair<char, metal::number<sizeof(char)>>,
metal::pair<float, metal::number<sizeof(float)>>
>;

IS_SAME(metal::has_key<m, int>, metal::true_);
IS_SAME(metal::has_key<m, char>, metal::true_);
IS_SAME(metal::has_key<m, float>, metal::true_);
IS_SAME(metal::has_key<m, void>, metal::false_);
/// [has_key]
)

HIDE(
/// [at_key]
using m = metal::map<
metal::pair<int, metal::number<sizeof(int)>>,
metal::pair<char, metal::number<sizeof(char)>>,
metal::pair<float, metal::number<sizeof(float)>>
>;

IS_SAME(metal::at_key<m, int>, metal::number<sizeof(int)>);
IS_SAME(metal::at_key<m, char>, metal::number<sizeof(char)>);
IS_SAME(metal::at_key<m, float>, metal::number<sizeof(float)>);
/// [at_key]
)

HIDE(
/// [erase_key]
using m = metal::map<
metal::pair<int, metal::number<sizeof(int)>>,
metal::pair<char, metal::number<sizeof(char)>>,
metal::pair<float, metal::number<sizeof(float)>>
>;

IS_SAME(
metal::erase_key<m, int>,
metal::map<
metal::pair<char, metal::number<sizeof(char)>>,
metal::pair<float, metal::number<sizeof(float)>>
>
);

IS_SAME(
metal::erase_key<m, char>,
metal::map<
metal::pair<int, metal::number<sizeof(int)>>,
metal::pair<float, metal::number<sizeof(float)>>
>
);

IS_SAME(
metal::erase_key<m, float>,
metal::map<
metal::pair<int, metal::number<sizeof(int)>>,
metal::pair<char, metal::number<sizeof(char)>>
>
);
/// [erase_key]
)

HIDE(
/// [keys]
using map = metal::map<
using m = metal::map<
metal::pair<int, metal::number<sizeof(int)>>,
metal::pair<char, metal::number<sizeof(char)>>,
metal::pair<float, metal::number<sizeof(float)>>
>;

IS_SAME(metal::keys<map>, metal::list<int, char, float>);
IS_SAME(metal::keys<m>, metal::list<int, char, float>);
/// [keys]
)

HIDE(
/// [values]
using map = metal::map<
using m = metal::map<
metal::pair<int, metal::number<sizeof(int)>>,
metal::pair<char, metal::number<sizeof(char)>>,
metal::pair<float, metal::number<sizeof(float)>>
>;

IS_SAME(
metal::values<map>,
metal::values<m>,
metal::list<
metal::number<sizeof(int)>,
metal::number<sizeof(char)>,
Expand Down
9 changes: 5 additions & 4 deletions example/src/pair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@

HIDE(
/// [pair1]
using pair = metal::list<int, unsigned>;
using p = metal::list<int, unsigned>;
/// [pair1]

IS_SAME(metal::is_pair<pair>, metal::true_);
IS_SAME(metal::is_pair<p>, metal::true_);
)

HIDE(
/// [is_pair]
IS_SAME(metal::is_pair<metal::list<int, unsigned>>, metal::true_);
IS_SAME(metal::is_pair<metal::list<int>>, metal::false_);
IS_SAME(metal::is_pair<metal::pair<int, unsigned>>, metal::true_);
IS_SAME(metal::is_pair<metal::list<void, void*>>, metal::true_);
IS_SAME(metal::is_pair<metal::list<void>>, metal::false_);
/// [is_pair]
)

Expand Down
2 changes: 1 addition & 1 deletion include/metal/config/version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
///
/// ### See Also
/// \see [Semantic Versioning](http://semver.org/)
#define METAL_PATCH 0
#define METAL_PATCH 1

/// \ingroup config
/// \hideinitializer
Expand Down
4 changes: 1 addition & 3 deletions include/metal/detail/declptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ namespace metal
namespace detail
{
template<typename T>
constexpr T* declptr() {
return nullptr;
}
T* declptr();
}
}

Expand Down
116 changes: 101 additions & 15 deletions include/metal/detail/fold_cons.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,117 @@ namespace metal
{};

template<
typename a, typename b, typename c, typename d,
typename e, typename f, typename g, typename h,
typename i, typename j, typename k, typename l,
typename m, typename n, typename o, typename p, typename tail,
typename _00, typename _01, typename _02, typename _03,
typename _04, typename _05, typename _06, typename _07,
typename _08, typename _09, typename _10, typename _11,
typename _12, typename _13, typename _14, typename _15,
typename _16, typename _17, typename _18, typename _19,
typename _20, typename _21, typename _22, typename _23,
typename _24, typename _25, typename _26, typename _27,
typename _28, typename _29, typename _30, typename _31,
typename _32, typename _33, typename _34, typename _35,
typename _36, typename _37, typename _38, typename _39,
typename _40, typename _41, typename _42, typename _43,
typename _44, typename _45, typename _46, typename _47,
typename _48, typename _49, typename _50, typename _51,
typename _52, typename _53, typename _54, typename _55,
typename _56, typename _57, typename _58, typename _59,
typename _60, typename _61, typename _62, typename _63,
typename _64, typename _65, typename _66, typename _67,
typename _68, typename _69, typename _70, typename _71,
typename _72, typename _73, typename _74, typename _75,
typename _76, typename _77, typename _78, typename _79,
typename _80, typename _81, typename _82, typename _83,
typename _84, typename _85, typename _86, typename _87,
typename _88, typename _89, typename _90, typename _91,
typename _92, typename _93, typename _94, typename _95,
typename _96, typename _97, typename _98, typename _99,
typename tail,
typename state, template<typename...> class expr
>
struct _fold_cons<
list<a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, tail>,
list<
_00, _01, _02, _03, _04, _05, _06, _07, _08, _09,
_10, _11, _12, _13, _14, _15, _16, _17, _18, _19,
_20, _21, _22, _23, _24, _25, _26, _27, _28, _29,
_30, _31, _32, _33, _34, _35, _36, _37, _38, _39,
_40, _41, _42, _43, _44, _45, _46, _47, _48, _49,
_50, _51, _52, _53, _54, _55, _56, _57, _58, _59,
_60, _61, _62, _63, _64, _65, _66, _67, _68, _69,
_70, _71, _72, _73, _74, _75, _76, _77, _78, _79,
_80, _81, _82, _83, _84, _85, _86, _87, _88, _89,
_90, _91, _92, _93, _94, _95, _96, _97, _98, _99, tail
>,
state,
lambda<expr>,
is_value<
expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<
state,
a>, b>, c>, d>, e>, f>, g>, h>,
i>, j>, k>, l>, m>, n>, o>, p>
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<state,
_00>, _01>, _02>, _03>, _04>, _05>, _06>, _07>, _08>, _09>,
_10>, _11>, _12>, _13>, _14>, _15>, _16>, _17>, _18>, _19>,
_20>, _21>, _22>, _23>, _24>, _25>, _26>, _27>, _28>, _29>,
_30>, _31>, _32>, _33>, _34>, _35>, _36>, _37>, _38>, _39>,
_40>, _41>, _42>, _43>, _44>, _45>, _46>, _47>, _48>, _49>,
_50>, _51>, _52>, _53>, _54>, _55>, _56>, _57>, _58>, _59>,
_60>, _61>, _62>, _63>, _64>, _65>, _66>, _67>, _68>, _69>,
_70>, _71>, _72>, _73>, _74>, _75>, _76>, _77>, _78>, _79>,
_80>, _81>, _82>, _83>, _84>, _85>, _86>, _87>, _88>, _89>,
_90>, _91>, _92>, _93>, _94>, _95>, _96>, _97>, _98>, _99>
>
> :
_fold_cons<
tail,
expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<
state,
a>, b>, c>, d>, e>, f>, g>, h>,
i>, j>, k>, l>, m>, n>, o>, p>,
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<state,
_00>, _01>, _02>, _03>, _04>, _05>, _06>, _07>, _08>, _09>,
_10>, _11>, _12>, _13>, _14>, _15>, _16>, _17>, _18>, _19>,
_20>, _21>, _22>, _23>, _24>, _25>, _26>, _27>, _28>, _29>,
_30>, _31>, _32>, _33>, _34>, _35>, _36>, _37>, _38>, _39>,
_40>, _41>, _42>, _43>, _44>, _45>, _46>, _47>, _48>, _49>,
_50>, _51>, _52>, _53>, _54>, _55>, _56>, _57>, _58>, _59>,
_60>, _61>, _62>, _63>, _64>, _65>, _66>, _67>, _68>, _69>,
_70>, _71>, _72>, _73>, _74>, _75>, _76>, _77>, _78>, _79>,
_80>, _81>, _82>, _83>, _84>, _85>, _86>, _87>, _88>, _89>,
_90>, _91>, _92>, _93>, _94>, _95>, _96>, _97>, _98>, _99>,
lambda<expr>
>
{};

template<
typename _00, typename _01, typename _02, typename _03,
typename _04, typename _05, typename _06, typename _07,
typename _08, typename _09, typename tail,
typename state, template<typename...> class expr
>
struct _fold_cons<
list<_00, _01, _02, _03, _04, _05, _06, _07, _08, _09, tail>,
state,
lambda<expr>,
is_value<
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<state,
_00>, _01>, _02>, _03>, _04>, _05>, _06>, _07>, _08>, _09>
>
> :
_fold_cons<
tail,
expr<expr<expr<expr<expr<expr<expr<expr<expr<expr<state,
_00>, _01>, _02>, _03>, _04>, _05>, _06>, _07>, _08>, _09>,
lambda<expr>
>
{};
Expand Down
Loading

0 comments on commit 0d2cbf3

Please sign in to comment.