当前位置: 首页>>代码示例>>C++>>正文


C++ range::empty方法代码示例

本文整理汇总了C++中range::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ range::empty方法的具体用法?C++ range::empty怎么用?C++ range::empty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在range的用法示例。


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

示例1:

template <typename Iter, typename Other> inline bool
operator == (range<Iter> const &value, range<Other> const &other) {
	if (value.size() == other.size()) {
		return value.empty() ? true : std::equal(value.begin(), value.end(), other.begin());
	}
	return false;
}
开发者ID:highpower,项目名称:fcgid,代码行数:7,代码来源:range.hpp

示例2: strncmp

inline bool
operator == (range<char const*> const &value, range<char const*> const &other) {
	if (value.size() == other.size()) {
		return value.empty() ? true : strncmp(value.begin(), other.begin(), value.size()) == 0;
	}
	return false;
}
开发者ID:highpower,项目名称:fcgid,代码行数:7,代码来源:range.hpp

示例3: compare

    void compare (Distances distances, Reference const & reference_)
{
    auto reference = range::view (reference_);

    while (!empty (reference)) {
        BOOST_CHECK (!empty (distances));
        if (empty (distances))
            return;

        auto d = chop_in_place (distances);
        auto r = chop_in_place (reference);
        BOOST_CHECK_EQUAL (first (d), first (r));
        BOOST_CHECK_EQUAL (second (d), second (r));
    }
    BOOST_CHECK (empty (distances));
}
开发者ID:guker,项目名称:flipsta,代码行数:16,代码来源:test-shortest_distance-sequence.cpp

示例4: check_repeat_a

template <class Parser> void check_repeat_a (Parser const & parser) {
    using range::empty; using range::first; using range::drop;
    {
        std::string r ("aa");
        auto result = parse (parser, r);
        BOOST_CHECK (success (result));
        auto o = output (result);
        BOOST_CHECK (!empty (o));
        BOOST_CHECK (!empty (drop (o)));
        BOOST_CHECK (empty (drop (drop (o))));
        BOOST_CHECK_EQUAL (first (o), 'a');
        BOOST_CHECK_EQUAL (first (drop (o)), 'a');
        BOOST_CHECK (empty (rest (result)));
    }
    {
        std::string r ("ab");
        auto result = parse (parser, r);
        BOOST_CHECK (success (result));
        auto o = output (result);
        BOOST_CHECK (!empty (o));
        BOOST_CHECK (empty (drop (o)));
        BOOST_CHECK_EQUAL (first (o), 'a');
        BOOST_CHECK_EQUAL (first (rest (result)), 'b');
    }
    {
        std::string r ("b");
        auto result = parse (parser, r);
        BOOST_CHECK (success (result));
        auto o = output (result);
        BOOST_CHECK (empty (o));
        BOOST_CHECK_EQUAL (first (rest (result)), 'b');
    }
}
开发者ID:rogiervd,项目名称:parse_ll,代码行数:33,代码来源:named.cpp

示例5: write_code_file

    void write_code_file(range const& file, range const& file_type) {
        int output_pipe[2];
        if (-1 == pipe(output_pipe)) {
            std::cerr << "could not create pipe for source-highlight\n";
            return;
        }

        int cpid = fork();
        if (-1 == cpid) {
            std::cerr << "could not create fork for source-highlight\n";
            return;
        }

        if (! cpid) {
            // source-highlight process
            close(output_pipe[0]);
            dup2(output_pipe[1], STDOUT_FILENO);

            std::string fileStr = file; // to append null

            if (file_type.empty())
                execlp(
                    "source-highlight", "source-highlight",
                    "-i", fileStr.c_str(), 0);
            else {
                std::string typeStr = file_type;
                execlp(
                    "source-highlight", "source-highlight",
                    "-s", typeStr.c_str(), "-i", fileStr.c_str(), 0);
            }

            std::cerr << "could not execute source-highlight\n";
            close(output_pipe[1]);
            return;
        }
        else {
            close(output_pipe[1]);
            print_source_highlight(output_pipe[0]);
            close(output_pipe[0]);
        }
    }
开发者ID:ohjames,项目名称:meow,代码行数:41,代码来源:ast_dump.hpp


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