• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ BOOST_HANA_CONSTANT_CHECK函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中BOOST_HANA_CONSTANT_CHECK函数的典型用法代码示例。如果您正苦于以下问题:C++ BOOST_HANA_CONSTANT_CHECK函数的具体用法?C++ BOOST_HANA_CONSTANT_CHECK怎么用?C++ BOOST_HANA_CONSTANT_CHECK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了BOOST_HANA_CONSTANT_CHECK函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: main

int main() {
    // Interoperation with hana::integral_constant
    BOOST_HANA_CONSTANT_CHECK(mpl::integral_c<int, 1>{} == hana::int_c<1>);
    BOOST_HANA_CONSTANT_CHECK(mpl::integral_c<int, 1>{} == hana::long_c<1>);

    BOOST_HANA_CONSTANT_CHECK(mpl::integral_c<int, 2>{} != hana::int_c<3>);
}
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:7,代码来源:interop.cpp


示例2: main

int main() {
    auto container = ::seq;

    {
        auto storage = container();
        auto transformed = hana::experimental::transformed(storage, undefined<99>{});
        BOOST_HANA_CONSTANT_CHECK(hana::equal(
            hana::length(transformed),
            hana::size_c<0>
        ));
    }{
        auto storage = container(undefined<0>{});
        auto transformed = hana::experimental::transformed(storage, undefined<99>{});
        BOOST_HANA_CONSTANT_CHECK(hana::equal(
            hana::length(transformed),
            hana::size_c<1>
        ));
    }{
        auto storage = container(undefined<0>{}, undefined<1>{});
        auto transformed = hana::experimental::transformed(storage, undefined<99>{});
        BOOST_HANA_CONSTANT_CHECK(hana::equal(
            hana::length(transformed),
            hana::size_c<2>
        ));
    }{
        auto storage = container(undefined<0>{}, undefined<1>{}, undefined<2>{});
        auto transformed = hana::experimental::transformed(storage, undefined<99>{});
        BOOST_HANA_CONSTANT_CHECK(hana::equal(
            hana::length(transformed),
            hana::size_c<3>
        ));
    }
}
开发者ID:Ding8222,项目名称:abelkhan,代码行数:33,代码来源:length.cpp


示例3: main

int main() {
    BOOST_HANA_CONSTANT_CHECK(hana::length(hana::make_tuple()) == hana::size_c<0>);
    BOOST_HANA_CONSTANT_CHECK(hana::length(hana::make_tuple(1, '2', 3.0)) == hana::size_c<3>);

    BOOST_HANA_CONSTANT_CHECK(hana::length(hana::nothing) == hana::size_c<0>);
    BOOST_HANA_CONSTANT_CHECK(hana::length(hana::just('x')) == hana::size_c<1>);
}
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:7,代码来源:length.cpp


示例4: main

int main() {
    // Conversion from any `Foldable` containing `type`s
    auto foldable = ::seq;
    auto to_list = hana::to<hana::ext::boost::mpl::list_tag>;
    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        to_list(foldable()),
        mpl::list<>{}
    ));

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        to_list(foldable(hana::type_c<t1>)),
        mpl::list<t1>{}
    ));

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        to_list(foldable(hana::type_c<t1>, hana::type_c<t2>)),
        mpl::list<t1, t2>{}
    ));

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        to_list(foldable(hana::type_c<t1>, hana::type_c<t2>, hana::type_c<t3>)),
        mpl::list<t1, t2, t3>{}
    ));

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        to_list(foldable(hana::type_c<t1>, hana::type_c<t2>, hana::type_c<t3>, hana::type_c<t4>)),
        mpl::list<t1, t2, t3, t4>{}
    ));
}
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:29,代码来源:to.cpp


示例5: main

int main() {
    auto container = ::seq;

    {
        auto storage1 = container();
        auto storage2 = container();
        auto joined = hana::experimental::joined(storage1, storage2);
        BOOST_HANA_CONSTANT_CHECK(hana::is_empty(joined));
    }
    {
        auto storage1 = container(undefined<0>{});
        auto storage2 = container();
        auto joined = hana::experimental::joined(storage1, storage2);
        BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(joined)));
    }
    {
        auto storage1 = container(undefined<0>{});
        auto storage2 = container(undefined<1>{});
        auto joined = hana::experimental::joined(storage1, storage2);
        BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(joined)));
    }
    {
        auto storage1 = container();
        auto storage2 = container(undefined<0>{});
        auto joined = hana::experimental::joined(storage1, storage2);
        BOOST_HANA_CONSTANT_CHECK(hana::not_(hana::is_empty(joined)));
    }
}
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:28,代码来源:is_empty.cpp


示例6: main

int main() {
    // works with elements whose `less` does not return a Constant
    {
        constexpr auto xs = hana::make_tuple(1, 2, 3, 4);
        constexpr auto ys = hana::make_tuple(1, 6, 3, 4);
        static_assert(hana::lexicographical_compare(xs, ys), "");
    }

    // and with those that do
    {
        auto xs = hana::make_tuple(hana::int_<1>, hana::int_<2>, hana::int_<3>);
        auto ys = hana::make_tuple(hana::int_<1>, hana::int_<5>, hana::int_<3>);
        BOOST_HANA_CONSTANT_CHECK(hana::lexicographical_compare(xs, ys));
    }

    // it also accepts a custom predicate
    {
        auto xs = hana::make_tuple(hana::type<int>, hana::type<char>, hana::type<void*>);
        auto ys = hana::make_tuple(hana::type<int>, hana::type<long>, hana::type<void*>);
        BOOST_HANA_CONSTANT_CHECK(
            hana::lexicographical_compare(xs, ys, [](auto t, auto u) {
                return hana::sizeof_(t) < hana::sizeof_(u);
            })
        );
    }
}
开发者ID:huaxiufeng,项目名称:hana,代码行数:26,代码来源:lexicographical_compare.cpp


示例7: main

int main() {
    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::make<hana::type_tag>(T{}),
        hana::decltype_(T{})
    ));

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::make<hana::type_tag>(hana::type_c<T>),
        hana::decltype_(hana::type_c<T>)
    ));

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::make_type(T{}),
        hana::make<hana::type_tag>(T{})
    ));

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::make_type(hana::type_c<T>),
        hana::make<hana::type_tag>(hana::type_c<T>)
    ));

    // make sure we don't read from non-constexpr variables
    {
        auto t = hana::type_c<T>;
        auto x = 1;
        constexpr auto r1 = hana::make<hana::type_tag>(t); (void)r1;
        constexpr auto r2 = hana::make<hana::type_tag>(x); (void)r2;
    }
}
开发者ID:Ding8222,项目名称:abelkhan,代码行数:29,代码来源:make.cpp


示例8: main

int main() {
    auto deref = [](auto x) { return *x; };
    auto deref3 = hana::compose(deref, deref, deref);

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        *hana::type_c<char*>,
        hana::type_c<char&>
    ));

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        deref(hana::type_c<int*>),
        hana::type_c<int&>
    ));

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        deref3(hana::type_c<int***>),
        hana::type_c<int&>
    ));

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::type_c<int> + hana::type_c<float>,
        hana::type_c<float>
    ));

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        ++hana::type_c<int&>,
        hana::type_c<int&>
    ));
}
开发者ID:npk48,项目名称:hana,代码行数:29,代码来源:type_operators.cpp


示例9: main

int main() {
    hana::test::_injection<0> f{};

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::unpack(hana::make_range(hana::int_c<0>, hana::int_c<0>), f),
        f()
    ));
    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::unpack(hana::make_range(hana::int_c<0>, hana::int_c<1>), f),
        f(hana::int_c<0>)
    ));
    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::unpack(hana::make_range(hana::int_c<0>, hana::int_c<2>), f),
        f(hana::int_c<0>, hana::int_c<1>)
    ));
    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::unpack(hana::make_range(hana::int_c<0>, hana::int_c<3>), f),
        f(hana::int_c<0>, hana::int_c<1>, hana::int_c<2>)
    ));

    // Previously, we would only unpack with `std::size_t`s. Make
    // sure this does not happen.
    hana::unpack(hana::make_range(hana::int_c<0>, hana::int_c<1>), [](auto x) {
        using T = hana::tag_of_t<decltype(x)>;
        static_assert(std::is_same<typename T::value_type, int>{}, "");
    });
}
开发者ID:jinby,项目名称:hana,代码行数:27,代码来源:unpack.cpp


示例10: main

int main() {
    BOOST_HANA_CONSTANT_CHECK(hana::char_c<'c'> ^hana::in^ BOOST_HANA_STRING("abcde"));
    BOOST_HANA_CONSTANT_CHECK(!(hana::char_c<'z'> ^hana::in^ BOOST_HANA_STRING("abcde")));

    BOOST_HANA_CONSTANT_CHECK(
        hana::find(BOOST_HANA_STRING("abcxefg"), hana::char_c<'x'>) == hana::just(hana::char_c<'x'>)
    );
}
开发者ID:Ding8222,项目名称:abelkhan,代码行数:8,代码来源:searchable.cpp


示例11: main

int main() {
    BOOST_HANA_CONSTANT_CHECK(
        hana::to<hana::tuple_tag>(hana::tuple_c<int, 0, 1, 2>)
            ==
        hana::make_tuple(hana::int_c<0>, hana::int_c<1>, hana::int_c<2>)
    );

    BOOST_HANA_CONSTANT_CHECK(hana::front(hana::tuple_c<int, 0, 1, 2>) == hana::int_c<0>);
}
开发者ID:surmountian,项目名称:hana,代码行数:9,代码来源:tuple_c.cpp


示例12: main

int main() {
    constexpr auto ints = hana::tuple_c<int, 1, 2, 3, 2, 2, 4, 2>;
    BOOST_HANA_CONSTANT_CHECK(hana::count(ints, hana::int_<2>) == hana::size_t<4>);
    static_assert(hana::count(ints, 2) == 4, "");


    constexpr auto types = hana::tuple_t<int, char, long, short, char, double>;
    BOOST_HANA_CONSTANT_CHECK(hana::count(types, hana::type<char>) == hana::size_t<2>);
}
开发者ID:huaxiufeng,项目名称:hana,代码行数:9,代码来源:count.cpp


示例13: main

int main() {
    constexpr auto x = hana::make<hana::optional_tag>();
    BOOST_HANA_CONSTANT_CHECK(x == hana::make_optional());
    BOOST_HANA_CONSTANT_CHECK(hana::is_nothing(x));

    constexpr auto just_x = hana::make<hana::optional_tag>('x');
    static_assert(just_x == hana::make_optional('x'), "");
    BOOST_HANA_CONSTANT_CHECK(hana::is_just(just_x));
}
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:9,代码来源:make.cpp


示例14: main

int main() {
    static_assert(hana::to<hana::tuple_tag>(hana::just(1)) == hana::make_tuple(1), "");
    BOOST_HANA_CONSTANT_CHECK(hana::to<hana::tuple_tag>(hana::nothing) == hana::make_tuple());

    BOOST_HANA_CONSTANT_CHECK(
        hana::to<hana::tuple_tag>(hana::make_range(hana::int_c<3>, hana::int_c<6>))
            ==
        hana::tuple_c<int, 3, 4, 5>
    );
}
开发者ID:surmountian,项目名称:hana,代码行数:10,代码来源:to.cpp


示例15: main

int main() {
    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::at_key(hana::make_map(p<0, 0>()), key<0>()),
        val<0>()
    ));

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::at_key(hana::make_map(p<0, 0>(), p<1,1>()), key<0>()),
        val<0>()
    ));
    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::at_key(hana::make_map(p<0, 0>(), p<1,1>()), key<1>()),
        val<1>()
    ));

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::at_key(hana::make_map(p<0, 0>(), p<1,1>(), p<2,2>()), key<0>()),
        val<0>()
    ));
    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::at_key(hana::make_map(p<0, 0>(), p<1,1>(), p<2,2>()), key<1>()),
        val<1>()
    ));
    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::at_key(hana::make_map(p<0, 0>(), p<1,1>(), p<2,2>()), key<2>()),
        val<2>()
    ));

    // check operators
    auto m = hana::make_map(p<2, 2>(), p<1, 1>());
    auto const const_m = hana::make_map(p<2, 2>(), p<1, 1>());
    BOOST_HANA_CONSTANT_CHECK(hana::equal(m[key<1>()], val<1>()));
    BOOST_HANA_CONSTANT_CHECK(hana::equal(const_m[key<1>()], val<1>()));
    BOOST_HANA_CONSTANT_CHECK(hana::equal(std::move(m)[key<1>()], val<1>()));
}
开发者ID:jinby,项目名称:hana,代码行数:35,代码来源:at_key.cpp


示例16: main

int main() {
    constexpr auto xs = hana::make_set(hana::int_c<0>, hana::int_c<1>, hana::int_c<2>);
    BOOST_HANA_CONSTANT_CHECK(hana::find(xs, hana::int_c<0>) == hana::just(hana::int_c<0>));
    BOOST_HANA_CONSTANT_CHECK(hana::find(xs, hana::int_c<3>) == hana::nothing);

    // operator[] is equivalent to at_key
    BOOST_HANA_CONSTANT_CHECK(xs[hana::int_c<2>] == hana::int_c<2>);

    // long_c<0> == int_<0>, and therefore int_<0> is found
    BOOST_HANA_CONSTANT_CHECK(xs[hana::long_c<0>] == hana::int_c<0>);
}
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:11,代码来源:searchable.cpp


示例17: main

int main() {
    BOOST_HANA_CONSTANT_CHECK(!hana::is_empty(BOOST_HANA_STRING("abcd")));
    BOOST_HANA_CONSTANT_CHECK(hana::is_empty(BOOST_HANA_STRING("")));

    BOOST_HANA_CONSTANT_CHECK(BOOST_HANA_STRING("abcd")[hana::size_c<2>] == hana::char_c<'c'>);

    auto is_vowel = [](auto c) {
        return c ^hana::in^ BOOST_HANA_STRING("aeiouy");
    };
    BOOST_HANA_CONSTANT_CHECK(
        hana::drop_while(BOOST_HANA_STRING("aioubcd"), is_vowel) == BOOST_HANA_STRING("bcd")
    );
}
开发者ID:LocutusOfBorg,项目名称:poedit,代码行数:13,代码来源:iterable.cpp


示例18: main

int main() {
    BOOST_HANA_CONSTANT_CHECK(
        hana::make_set(hana::int_c<0>, hana::type_c<char>, hana::int_c<1>)
        ==
        hana::make_set(hana::int_c<1>, hana::int_c<0>, hana::type_c<char>)
    );

    BOOST_HANA_CONSTANT_CHECK(
        hana::make_set(hana::int_c<0>, hana::type_c<char>)
        !=
        hana::make_set(hana::int_c<1>)
    );
}
开发者ID:triagens,项目名称:arangodb,代码行数:13,代码来源:comparable.cpp


示例19: main

int main() {
    hana::test::_injection<0> f{};
    hana::test::ct_eq<2> x{};

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::maybe(x, undefined{}, hana::nothing),
        x
    ));

    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::maybe(undefined{}, f, hana::just(x)),
        f(x)
    ));
}
开发者ID:jinby,项目名称:hana,代码行数:14,代码来源:maybe.cpp


示例20: main

int main() {
    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::minimum(hana::make_range(hana::int_c<3>, hana::int_c<4>)),
        hana::int_c<3>
    ));
    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::minimum(hana::make_range(hana::int_c<3>, hana::int_c<5>)),
        hana::int_c<3>
    ));
    BOOST_HANA_CONSTANT_CHECK(hana::equal(
        hana::minimum(hana::make_range(hana::int_c<-1>, hana::int_c<5>)),
        hana::int_c<-1>
    ));
}
开发者ID:Ding8222,项目名称:abelkhan,代码行数:14,代码来源:minimum.cpp



注:本文中的BOOST_HANA_CONSTANT_CHECK函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BOOST_LOG_FUNCTION函数代码示例发布时间:2022-05-30
下一篇:
C++ BOOST_CONCEPT_ASSERT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap