-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Rename: - `first` to `front` - `last` to `back` - `not_first` to `pop_front` - `not_last` to `pop_back` - Introduce `cat` in place of `merge` - Introduce `extract::none`, `pack`, `size`, `unpack` - Introduce direct pack operators (`pack_cat`, `pack_clear`, `pack_size`) - Introduce shorthands for `type_frame` and `templated_type_frame` - Add loose operators as nested using declarations in `collection` - Every operator is defined as struct (and introduce def.hpp header) to solve cross references problem - Progress documentation - Progress unit tests with new library layout
- Loading branch information
md
committed
Mar 22, 2017
1 parent
b274d8b
commit 9fe12b6
Showing
28 changed files
with
989 additions
and
443 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,79 @@ | ||
// Copyright Marek Dalewski 2017 | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// (See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#pragma once | ||
|
||
#include <utility> | ||
|
||
#include <variadic/at.hpp> | ||
#include <variadic/collection.hpp> | ||
#include <variadic/def.hpp> | ||
|
||
namespace variadic | ||
{ | ||
|
||
namespace detail | ||
{ | ||
|
||
// template <typename... Types> | ||
// struct back_impl; | ||
|
||
// template <> | ||
// struct back_impl<> | ||
// {}; | ||
|
||
// template <typename T> | ||
// struct back_impl<T> | ||
// { | ||
// using type = T; | ||
// }; | ||
|
||
// template <typename T, typename Y, typename... Types> | ||
// struct back_impl<T, Y, Types...> | ||
// { | ||
// using type = typename back<Y, Types...>::type; | ||
// }; | ||
|
||
template <typename... Types> | ||
struct back_impl; | ||
|
||
template <> | ||
struct back_impl<> | ||
{}; | ||
|
||
template <typename T, typename... Types> | ||
struct back_impl<T, Types...> | ||
{ | ||
using type = typename at<sizeof...(Types), T, Types...>::type; | ||
}; | ||
|
||
template <class Sequence, typename... Types> | ||
struct pop_back_impl; | ||
|
||
template <size_t... Idxs, typename... Types> | ||
struct pop_back_impl<std::index_sequence<Idxs...>, Types...> | ||
{ | ||
using types = collection<typename at<Idxs, Types...>::type...>; | ||
}; | ||
|
||
} // namespace detail | ||
|
||
template <typename... Types> | ||
struct back | ||
{ | ||
static_assert(sizeof...(Types) > 0, "No back item in empty template parametr pack"); | ||
|
||
using type = typename detail::back_impl<Types...>::type; | ||
}; | ||
|
||
template <typename... Types> | ||
struct pop_back | ||
{ | ||
static_assert(sizeof...(Types) > 0, "No not back item(s) in empty template parametr pack"); | ||
|
||
using types = typename detail::pop_back_impl<std::make_index_sequence<sizeof...(Types) - 1>, Types...>::types; | ||
}; | ||
|
||
} // namespace variadic |
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,74 @@ | ||
// Copyright Marek Dalewski 2017 | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// (See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#pragma once | ||
|
||
#include <variadic/collection.hpp> | ||
#include <variadic/def.hpp> | ||
#include <variadic/pack.hpp> | ||
|
||
namespace variadic | ||
{ | ||
|
||
namespace detail | ||
{ | ||
|
||
// template <typename ResultCollection, typename... Collections> | ||
// struct pack_cat_impl; | ||
|
||
// template <typename ResultCollection> | ||
// struct pack_cat_impl<ResultCollection> | ||
// { | ||
// using types = ResultCollection; | ||
// }; | ||
|
||
// template <typename ResultCollection, typename C0, typename... Collections> | ||
// struct pack_cat_impl<ResultCollection, C0, Collections...> | ||
// { | ||
// using types = typename pack_cat_impl<typename C0::template emplace<ResultCollection::template push_back>, Collections...>::types; | ||
// }; | ||
|
||
template <typename FirstCollection, typename... Collections> | ||
struct pack_cat_impl__collections; | ||
|
||
template <typename FirstCollection> | ||
struct pack_cat_impl__collections<FirstCollection> | ||
{ | ||
using types = FirstCollection; | ||
}; | ||
|
||
template <typename FirstCollection, typename NextCollection, typename... Collections> | ||
struct pack_cat_impl__collections<FirstCollection, NextCollection, Collections...> | ||
{ | ||
using types = typename pack_cat_impl__collections<typename NextCollection::template emplace<FirstCollection::template push_back>, Collections...>::types; | ||
}; | ||
|
||
template <typename... Packs> | ||
struct pack_cat_impl | ||
{ | ||
using types = typename pack_cat_impl__collections<collection<>, typename unpack_impl<Packs>::types...>::types; | ||
}; | ||
|
||
} // namespace detail | ||
|
||
template <typename... Packs> | ||
struct pack_cat | ||
{ | ||
using types = typename detail::pack_cat_impl<Packs...>::types; | ||
}; | ||
|
||
template <typename... Types> | ||
struct cat | ||
{ | ||
template <typename... OtherTypes> | ||
using with = cat<Types..., OtherTypes...>; | ||
|
||
template <typename... Packs> | ||
using with_pack = typename pack_cat<collection<Types...>, Packs...>::types::template emplace<cat>; | ||
|
||
using types = collection<Types...>; | ||
}; | ||
|
||
} // namespace variadic |
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,36 @@ | ||
// Copyright Marek Dalewski 2017 | ||
// Distributed under the Boost Software License, Version 1.0. | ||
// (See accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#pragma once | ||
|
||
#include <variadic/def.hpp> | ||
|
||
namespace variadic | ||
{ | ||
|
||
namespace detail | ||
{ | ||
|
||
template <typename Pack> | ||
struct pack_clear_impl | ||
{}; | ||
|
||
template <template <typename...> typename Pack, typename... Packed> | ||
struct pack_clear_impl<Pack<Packed...>> | ||
{ | ||
template <typename... Types> | ||
using type = Pack<Types...>; | ||
}; | ||
|
||
} // namespace detail | ||
|
||
template <typename Pack> | ||
struct pack_clear | ||
{ | ||
template <typename... Types> | ||
using type = typename detail::pack_clear_impl<Pack>::template type<Types...>; | ||
}; | ||
|
||
} // namespace variadic |
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
Oops, something went wrong.