Skip to content

Commit

Permalink
bulk update (2014/09/28)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcelo Juchem committed Oct 2, 2014
1 parent 2f330c5 commit def18a0
Show file tree
Hide file tree
Showing 19 changed files with 1,682 additions and 1,195 deletions.
Binary file modified docs/cppcon2014.pdf
Binary file not shown.
4 changes: 2 additions & 2 deletions fatal/container/flag_set.h
Expand Up @@ -53,7 +53,7 @@ struct flag_set {
);

static_assert(
logical_and_constants<
logical_transform::all<
std::true_type,
std::is_same<TFlags, typename std::decay<TFlags>::type>...
>::value,
Expand All @@ -64,7 +64,7 @@ struct flag_set {
typedef mersenne_number<tag_list::size> range_mask;

template <bool IgnoreUnsupported, typename... UFlags>
using mask_for = bitwise_or_constants<
using mask_for = bitwise_transform::any<
std::integral_constant<flags_type, 0>,
std::integral_constant<
typename std::enable_if<
Expand Down
14 changes: 13 additions & 1 deletion fatal/container/tagged_tuple.h
Expand Up @@ -25,7 +25,7 @@ namespace fatal {

template <typename... Args>
struct tagged_tuple {
using pairs = type_list<Args...>;
using map = type_map<Args...>;
using tags = tuple_tags<type_get_first<Args>...>;
using values = type_list<type_get_second<Args>...>;
using tuple_type = typename values::template apply<std::tuple>;
Expand Down Expand Up @@ -53,6 +53,18 @@ struct tagged_tuple {
constexpr fast_pass<tuple_type> tuple() const { return data_; }
tuple_type &tuple() { return data_; }

// TODO: TEST
template <typename... UArgs>
bool operator ==(tagged_tuple<UArgs...> const &rhs) const {
return data_ == rhs.tuple();
}

// TODO: TEST
template <typename... UArgs>
bool operator !=(tagged_tuple<UArgs...> const &rhs) const {
return !(*this == rhs);
}

private:
tuple_type data_;
};
Expand Down
6 changes: 3 additions & 3 deletions fatal/container/test/tuple_tags_test.cpp
Expand Up @@ -21,10 +21,10 @@ struct Gaz {};
TEST(tuple_tags, tags) {
typedef tuple_tags<Foo, Bar, Baz, Gaz> tags;

FATAL_EXPECT_SAME<type_list<Foo, Bar, Baz, Gaz>, tags::tags>();
FATAL_EXPECT_SAME<type_list<Foo, Bar, Baz, Gaz>, tags::list>();
}

TEST(tuple_tags, tag_map) {
TEST(tuple_tags, map) {
typedef tuple_tags<Foo, Bar, Baz, Gaz> tags;
typedef std::tuple<int, double, bool, long> tuple;

Expand All @@ -35,7 +35,7 @@ TEST(tuple_tags, tag_map) {
type_pair<Baz, bool>,
type_pair<Gaz, long>
>,
tags::tag_map<tuple>
tags::map<tuple>
>();
}

Expand Down
8 changes: 4 additions & 4 deletions fatal/container/tuple_tags.h
Expand Up @@ -24,7 +24,7 @@ struct tuple_tags {
*
* @author: Marcelo Juchem <marcelo@fb.com>
*/
typedef type_list<TTags...> tags;
typedef type_list<TTags...> list;

/**
* Gets the index associated with a given tag.
Expand All @@ -49,7 +49,7 @@ struct tuple_tags {
* @author: Marcelo Juchem <marcelo@fb.com>
*/
template <typename TTag>
using index_of = typename tags::template index_of<TTag>;
using index_of = typename list::template index_of<TTag>;

/**
* Gets the type of the tuple's element associated with a given tag.
Expand Down Expand Up @@ -92,12 +92,12 @@ struct tuple_tags {
* // type_pair<Baz, bool>,
* // type_pair<Gaz, long>
* // >`
* typedef tags::tag_map<tuple> result;
* typedef tags::map<tuple> result;
*
* @author: Marcelo Juchem <marcelo@fb.com>
*/
template <typename TTuple>
using tag_map = type_map<
using map = type_map<
type_pair<TTags, type_of<TTags, TTuple>>...
>;

Expand Down
1 change: 1 addition & 0 deletions fatal/test/driver.h
Expand Up @@ -20,6 +20,7 @@
////////////

int main(int argc, char **argv) {
FLAGS_logtostderr = true;
google::InitGoogleLogging(argc > 0 ? argv[0] : "unknown");
testing::InitGoogleTest(&argc, argv);
google::ParseCommandLineFlags(&argc, &argv, true);
Expand Down

0 comments on commit def18a0

Please sign in to comment.