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


C++ ContainerT类代码示例

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


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

示例1: replace_ellipsis

 void replace_ellipsis (std::vector<ContainerT> const &arguments,
     typename ContainerT::size_type index, 
     ContainerT &expanded, PositionT const &pos)
 {
     using namespace cpplexer;
     typedef typename ContainerT::value_type token_type;
     
     token_type comma(T_COMMA, ",", pos);
     for (/**/; index < arguments.size(); ++index) {
     ContainerT const &arg = arguments[index];
     
         std::copy(arg.begin(), arg.end(), 
             std::inserter(expanded, expanded.end()));
             
         if (index < arguments.size()-1) 
             expanded.push_back(comma);
     }
 }
开发者ID:AlexRa,项目名称:Kirstens-clone,代码行数:18,代码来源:macro_helpers.hpp

示例2: found_unknown_directive

 bool
 found_unknown_directive(ContextT const& ctx, ContainerT const& line, 
     ContainerT& pending)
 {
     BOOST_WAVETEST_OSSTREAM strm;
     strm << "21: " << repr((*line.begin()).get_position()) << ": " 
          << boost::wave::util::impl::as_string(line) << std::endl;
     hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
     return false; 
 }
开发者ID:OggYiu,项目名称:rag-engine,代码行数:10,代码来源:collect_hooks_information.hpp

示例3: trim_replacement_list

inline void
trim_replacement_list (ContainerT &replacement_list)
{
    using namespace boost::wave;

// strip leading whitespace
    if (replacement_list.size() > 0) {
    typename ContainerT::iterator end = replacement_list.end();
    typename ContainerT::iterator it = replacement_list.begin();

        while (it != end && IS_CATEGORY(*it, WhiteSpaceTokenType)) { 
            if (T_PLACEHOLDER != token_id(*it)) {
                typename ContainerT::iterator next = it;
                ++next;
                replacement_list.erase(it);
                it = next;
            }
            else {
                ++it;
            }
        }
    }

// strip trailing whitespace
    if (replacement_list.size() > 0) {
    typename ContainerT::reverse_iterator rend = replacement_list.rend();
    typename ContainerT::reverse_iterator rit = replacement_list.rbegin();

        while (rit != rend && IS_CATEGORY(*rit, WhiteSpaceTokenType)) 
            ++rit;

    typename ContainerT::iterator end = replacement_list.end();
    typename ContainerT::iterator it = rit.base();

        while (it != end && IS_CATEGORY(*it, WhiteSpaceTokenType)) { 
            if (T_PLACEHOLDER != token_id(*it)) {
                typename ContainerT::iterator next = it;
                ++next;
                replacement_list.erase(it);
                it = next;
            }
            else {
                ++it;
            }
        }
    }
}
开发者ID:QuentinRougemont,项目名称:MicrosatDemogInference,代码行数:47,代码来源:cpp_macromap_utils.hpp

示例4: parameters_equal

inline bool 
parameters_equal(ContainerT const &parameters, ContainerT const &new_parameters)
{
    if (parameters.size() != new_parameters.size())
        return false;   // different parameter count

    typedef typename ContainerT::const_iterator const_iterator_type;

const_iterator_type first1 = parameters.begin();
const_iterator_type last1 = parameters.end();
const_iterator_type first2 = new_parameters.begin();
const_iterator_type last2 = new_parameters.end();

    while (first1 != last1 && first2 != last2) {
    // parameters are different, if the corresponding tokens are different
        using namespace boost::wave;
        if (token_id(*first1) != token_id(*first2) ||
            (*first1).get_value() != (*first2).get_value())
        {
            break;
        }
        ++first1;
        ++first2;
    }
    return (first1 == last1 && first2 == last2) ? true : false;
}
开发者ID:QuentinRougemont,项目名称:MicrosatDemogInference,代码行数:26,代码来源:cpp_macromap_utils.hpp

示例5: found_unknown_directive

    bool
    found_unknown_directive(ContextT const& ctx, ContainerT const& line, 
        ContainerT& pending)
    {
        namespace wave = boost::wave;

        typedef typename ContainerT::const_iterator iterator_type;
        iterator_type it = line.begin();
        wave::token_id id = wave::util::impl::skip_whitespace(it, line.end());

        if (id != wave::T_IDENTIFIER)
            return false;       // nothing we could do

        if ((*it).get_value() == "version" || (*it).get_value() == "extension")
        {
            // handle #version and #extension directives
            std::copy(line.begin(), line.end(), std::back_inserter(pending));
            return true;
        }

        return false;           // unknown directive
    }
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:22,代码来源:custom_directives.hpp

示例6: definition_equals

inline bool 
definition_equals(ContainerT const &definition, 
    ContainerT const &new_definition)
{
    typedef typename ContainerT::const_iterator const_iterator_type;

const_iterator_type first1 = definition.begin();
const_iterator_type last1 = definition.end();
const_iterator_type first2 = new_definition.begin();
const_iterator_type last2 = new_definition.end();

    while (first1 != last1 && first2 != last2 && token_equals(*first1, *first2)) 
    {
    // skip whitespace, if both sequences have a whitespace next
    token_id id1 = next_token<const_iterator_type>::peek(first1, last1, false);
    token_id id2 = next_token<const_iterator_type>::peek(first2, last2, false);

        if (IS_CATEGORY(id1, WhiteSpaceTokenType) && 
            IS_CATEGORY(id2, WhiteSpaceTokenType)) 
        {
        // all consecutive whitespace tokens count as one whitespace
        // adjust first1 and first2 accordingly
            skip_whitespace(first1, last1);
            skip_whitespace(first2, last2);
        }
        else if (!IS_CATEGORY(id1, WhiteSpaceTokenType) && 
                 !IS_CATEGORY(id2, WhiteSpaceTokenType)) 
        {
            ++first1;
            ++first2;
        }
        else {
        // the sequences differ
            break;
        }
    }
    return (first1 == last1 && first2 == last2) ? true : false;
}
开发者ID:QuentinRougemont,项目名称:MicrosatDemogInference,代码行数:38,代码来源:cpp_macromap_utils.hpp

示例7: tokenize

void tokenize(const std::string& str, ContainerT& tokens, const std::string& delimiters, const bool trimEmpty)
{
/*
 I usually choose to use std::vector<std::string> types as my second parameter
  (ContainerT)... but list<> is way faster than vector<> for when direct access
   is not needed, and you can even create your own string class and use something
    like std::list<SubString> where SubString does not do any copies for incredible speed increases.
It's more than double as fast as the fastest tokenize on this page and almost 5 times
faster than some others. Also with the perfect parameter types you can eliminate all string and list copies.
Additionally it does not do the (extremely inefficient) return of result, but rather
it passes the tokens as a reference, thus also allowing you to build up tokens using
multiple calls if you so wished.Lastly it allows you to specify whether to trim empty
tokens from the results via a last optional parameter.All it needs is std::string...
the rest are optional. It does not use streams or the boost library, but is flexible
enough to be able to accept some of these foreign types naturally.
 */
	std::string::size_type pos, lastPos = 0;
	while(true)
	{
		pos = str.find_first_of(delimiters, lastPos);
		if(pos == std::string::npos)
		{
			pos = str.length();
			if(pos != lastPos || !trimEmpty)
			{
				tokens.push_back(typename ContainerT::value_type(str.data()+lastPos, typename ContainerT::value_type::size_type(pos-lastPos)));
			}
			break;
		}
		else
		{
			if(pos != lastPos || !trimEmpty)
				tokens.push_back(typename ContainerT::value_type(str.data()+lastPos, typename ContainerT::value_type::size_type(pos-lastPos )));
		}

		lastPos = pos + 1;
	}
}
开发者ID:zhenglei-gao,项目名称:pestpp,代码行数:38,代码来源:utilities.cpp

示例8: tokenize

void tokenize(const std::string& str, ContainerT& tokens,
              const std::string& delimiters = " ", const bool trimEmpty = false)
{
  std::string::size_type pos, lastPos = 0;
  while (true)
  {
    pos = str.find_first_of(delimiters, lastPos);
    if (pos == std::string::npos)
    {
      pos = str.length();

      if (pos != lastPos || !trimEmpty)
        tokens.push_back(typename ContainerT::value_type(str.data() + lastPos, pos - lastPos));
      break;
    }
    else
    {
      if (pos != lastPos || !trimEmpty)
        tokens.push_back(typename ContainerT::value_type(str.data() + lastPos, pos - lastPos));
    }
    lastPos = pos + 1;
  }
};
开发者ID:koz4,项目名称:xbmc-pvr-addons,代码行数:23,代码来源:MythEventHandler.cpp

示例9: push_front_test

void push_front_test()
{
    using namespace boost::spirit;

    const char* cp = "one,two,three";
    const char* cp_first = cp;
    const char* cp_last = cp + test_impl::string_length(cp);
    const char* cp_i[] = {"one","two","three"};;
    int i;
    ContainerT c;
    typename ContainerT::const_iterator it;

    scanner<char const*> scan( cp_first, cp_last );
    match<> hit;

    hit = list_p( (*alpha_p)[ push_front_a(c)] , ch_p(',') ).parse(scan);
    BOOST_CHECK(hit);
    BOOST_CHECK_EQUAL(scan.first, scan.last);
    BOOST_CHECK_EQUAL( c.size(), static_cast<typename ContainerT::size_type>(3));
    for (i=2, it = c.begin();i>=0 && it != c.end();--i, ++it)
        BOOST_CHECK_EQUAL( cp_i[i], *it);
    scan.first = cp;
}
开发者ID:KerwinMa,项目名称:AerothFlyffSource,代码行数:23,代码来源:push_front_test.cpp

示例10: emit_line_directive

    bool 
    emit_line_directive(ContextT const& ctx, ContainerT &pending, 
        typename ContextT::token_type const& act_token)
    {
        if (!need_emit_line_directives(ctx.get_language()) ||
            !enable_relative_names_in_line_directives())
        {
            return false;
        }

    // emit a #line directive showing the relative filename instead
    typename ContextT::position_type pos = act_token.get_position();
    unsigned int column = 6;

        typedef typename ContextT::token_type result_type;
        using namespace boost::wave;

        pos.set_column(1);
        pending.push_back(result_type(T_PP_LINE, "#line", pos));

        pos.set_column(column);      // account for '#line'
        pending.push_back(result_type(T_SPACE, " ", pos));

    // 21 is the max required size for a 64 bit integer represented as a 
    // string
    char buffer[22];

        using namespace std;    // for some systems sprintf is in namespace std
        sprintf (buffer, "%d", pos.get_line());

        pos.set_column(++column);                 // account for ' '
        pending.push_back(result_type(T_INTLIT, buffer, pos));
        pos.set_column(column += (unsigned int)strlen(buffer)); // account for <number>
        pending.push_back(result_type(T_SPACE, " ", pos));
        pos.set_column(++column);                 // account for ' '

    std::string file("\"");
    boost::filesystem::path filename(
        boost::wave::util::create_path(ctx.get_current_relative_filename().c_str()));

        using boost::wave::util::impl::escape_lit;
        file += escape_lit(boost::wave::util::native_file_string(filename)) + "\"";

        pending.push_back(result_type(T_STRINGLIT, file.c_str(), pos));
        pos.set_column(column += (unsigned int)file.size());    // account for filename
        pending.push_back(result_type(T_GENERATEDNEWLINE, "\n", pos));

        return true;
    }
开发者ID:CliffsDover,项目名称:wesnoth_ios,代码行数:49,代码来源:trace_macro_expansion.hpp

示例11: values

WLEExponent::ContainerT WLEExponent::values()
{
    ContainerT con;

    con.insert( WLEExponent::KILO );
    con.insert( WLEExponent::BASE );
    con.insert( WLEExponent::CENTI );
    con.insert( WLEExponent::MILLI );
    con.insert( WLEExponent::MICRO );
    con.insert( WLEExponent::NANO );
    con.insert( WLEExponent::PICO );
    con.insert( WLEExponent::FEMTO );

    return con;
}
开发者ID:labp,项目名称:na-online_ow-toolbox,代码行数:15,代码来源:WLEExponent.cpp

示例12: DynamicGraph

    /**
     * Constructs a DynamicGraph from a list of edges sorted by source node id.
     */
    template <class ContainerT> DynamicGraph(const NodeIterator nodes, const ContainerT &graph)
    {
        // we need to cast here because DeallocatingVector does not have a valid const iterator
        BOOST_ASSERT(std::is_sorted(const_cast<ContainerT&>(graph).begin(), const_cast<ContainerT&>(graph).end()));

        number_of_nodes = nodes;
        number_of_edges = static_cast<EdgeIterator>(graph.size());
        node_array.resize(number_of_nodes + 1);
        EdgeIterator edge = 0;
        EdgeIterator position = 0;
        for (const auto node : osrm::irange(0u, number_of_nodes))
        {
            EdgeIterator last_edge = edge;
            while (edge < number_of_edges && graph[edge].source == node)
            {
                ++edge;
            }
            node_array[node].first_edge = position;
            node_array[node].edges = edge - last_edge;
            position += node_array[node].edges;
        }
        node_array.back().first_edge = position;
        edge_list.reserve(static_cast<std::size_t>(edge_list.size() * 1.1));
        edge_list.resize(position);
        edge = 0;
        for (const auto node : osrm::irange(0u, number_of_nodes))
        {
            for (const auto i : osrm::irange(node_array[node].first_edge,
                                             node_array[node].first_edge + node_array[node].edges))
            {
                edge_list[i].target = graph[edge].target;
                BOOST_ASSERT(edge_list[i].target < number_of_nodes);
                edge_list[i].data = graph[edge].data;
                ++edge;
            }
        }
    }
开发者ID:7890,项目名称:osrm-backend,代码行数:40,代码来源:dynamic_graph.hpp

示例13: initArgs

 void initArgs(ContainerT& cc) {
     cc.arg( base::DataSourceBase::shared_ptr(ma1.value) );
     cc.arg( base::DataSourceBase::shared_ptr(ma2.value) );
     cc.arg( base::DataSourceBase::shared_ptr(ma3.value) );
     cc.arg( base::DataSourceBase::shared_ptr(ma4.value) );
 }
开发者ID:FynnGamadeyo,项目名称:rtt,代码行数:6,代码来源:DataSourceStorage.hpp

示例14: containerStr

std::string containerStr (const ContainerT& c, int wrapLengthParam = 0, int numIndentationSpaces = 0)
{
	return elemsStr(c.begin(), c.end(), wrapLengthParam, numIndentationSpaces);
}
开发者ID:jekstrand,项目名称:Vulkan-CTS,代码行数:4,代码来源:vktTessellationUtil.hpp

示例15: find_first

template<class ContainerT, class ValueT> inline
auto find_first(const ContainerT& _container, const ValueT& _value) {
    return sq::algo::find_first(_container.begin(), _container.end(), _value);
}
开发者ID:jagoly,项目名称:sqee,代码行数:4,代码来源:Algorithms.hpp


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