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


C++ value_type::size方法代码示例

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


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

示例1: then_else

bool parameters::then_else( bool expr, value_type const &s,
                            value_type::size_type *pos,
                            value_type *replacement ) const {
  value_type::value_type c = s[ *pos ];
  bool found_param = false, not_empty = false;

  switch ( c ) {
    case_123456789:
      found_param = true;
      if ( expr ) {
        *replacement = lookup_param( to_index( c ) );
        not_empty = !replacement->empty();
      }
      break;
    case '{':
      while ( ++*pos < s.size() ) {
        c = s[ *pos ];
        switch ( c ) {
          case_123456789:
            found_param = true;
            if ( expr ) {
              value_type const param = lookup_param( to_index( c ) );
              not_empty = !param.empty() || not_empty;
              *replacement += param;
            }
            break;
          case '}':
            goto done;
          case '\\':
            if ( *pos + 1 < s.size() )
              c = s[ ++*pos ];
            // no break;
          default:
            if ( expr )
              *replacement += c;
        } // switch
      } // while
      throw invalid_argument( "'}' expected for ?:" );
    default:
      throw invalid_argument(
        BUILD_STRING(
          '\'', c, "': invalid character after '", (expr ? '?' : ':'),
          "' (one of [1-9{] expected)"
        )
      );
  } // switch

done:
  return !found_param || not_empty;
}
开发者ID:zorba-processor,项目名称:zorba,代码行数:50,代码来源:diagnostic.cpp

示例2: format_reverse

    //! The function performs formatting of the extracted scope stack in reverse direction
    void format_reverse(stream_type& strm, value_type const& scopes) const
    {
        value_type::const_reverse_iterator it = scopes.rbegin(), end;
        if (m_depth > 0)
        {
            value_type::size_type const scopes_to_iterate = (std::min)(m_depth, scopes.size());
            end = it;
            std::advance(end, static_cast< value_type::difference_type >(scopes_to_iterate));
        }
        else
        {
            end = scopes.rend();
        }

        if (it != end)
        {
            m_element_formatter(strm, *it);
            for (++it; it != end; ++it)
            {
                strm << m_delimiter;
                m_element_formatter(strm, *it);
            }

            if (it != scopes.rend())
                strm << m_incomplete_marker;
        }
    }
开发者ID:ACEZLY,项目名称:GreenLeaf,代码行数:28,代码来源:named_scope.hpp

示例3: format_forward

    //! The function performs formatting of the extracted scope stack in forward direction
    void format_forward(stream_type& strm, value_type const& scopes) const
    {
        value_type::const_iterator it, end = scopes.end();
        if (m_depth > 0)
        {
            value_type::size_type const scopes_to_iterate = (std::min)(m_depth, scopes.size());
            it = scopes.end();
            std::advance(it, -static_cast< value_type::difference_type >(scopes_to_iterate));
        }
        else
        {
            it = scopes.begin();
        }

        if (it != end)
        {
            if (it != scopes.begin())
                strm << "..." << m_delimiter;

            m_element_formatter(strm, *it);
            for (++it; it != end; ++it)
            {
                strm << m_delimiter;
                m_element_formatter(strm, *it);
            }
        }
    }
开发者ID:MisterTea,项目名称:MAMEHub,代码行数:28,代码来源:named_scope.hpp

示例4: bind

 static void bind( sqlite3_stmt* statement_handle, std::size_t index, value_type value )
 {
     sqlite3_bind_blob(
         statement_handle, index
       , value.bytes(), value.size(), SQLITE_TRANSIENT
     );
 }
开发者ID:eggs-cpp,项目名称:eggs-sqlite,代码行数:7,代码来源:raw_traits.hpp

示例5:

 hex_pair_iterator operator ++() {
   // We're at the end of the input.
   if (Current == End) {
     IsDone = true;
     return *this;
   }
   Pair = value_type();
   for (; Current != End && Pair.size() != 2; ++Current) {
     // Is a valid hex digit.
     if ((*Current >= '0' && *Current <= '9') ||
         (*Current >= 'a' && *Current <= 'f') ||
         (*Current >= 'A' && *Current <= 'F'))
       Pair.push_back(*Current);
   }
   // Hit the end without getting 2 hex digits. Pair is invalid.
   if (Pair.size() != 2)
     IsDone = true;
   return *this;
 }
开发者ID:epowers,项目名称:llvm,代码行数:19,代码来源:yaml2obj.cpp

示例6: set

void unc_text::set(const value_type& data, int idx, int len)
{
   fix_len_idx(data.size(), idx, len);
   m_chars.resize(len);
   int di = 0;
   while (len-- > 0)
   {
      m_chars[di++] = data[idx++];
   }
   m_logok = false;
}
开发者ID:EvilOne,项目名称:uncrustify,代码行数:11,代码来源:unc_text.cpp

示例7: set

void unc_text::set(const value_type &data, size_t idx, size_t len)
{
   m_chars.resize(len);

   len = fix_len_idx(data.size(), idx, len);
   for (size_t di = 0;
        len > 0;
        di++, idx++, len--)
   {
      m_chars[di] = data[idx];
   }


   update_logtext();
}
开发者ID:paolodedios,项目名称:uncrustify,代码行数:15,代码来源:unc_text.cpp

示例8: GetEarliestIndex

    GLuint GetEarliestIndex(value_type const &key, GLuint curIndex)
    {
        union
        {
            float F;
            GLuint H;
        } U;

        GLuint hash = OFFSET;
        for (std::size_t i = 0; i < key.size(); ++i)
        {
            U.F = key[i];
            hash ^= U.H;
            hash *= PRIME;
        }

        // Maintain key/hash state invariant.
        GLuint killIndex = curIndex % mDepth;
        mHash[killIndex] = hash;
        mAttr[killIndex] = key;
        mIndex[killIndex] = curIndex;

        // Starting at the further index from ours,
        // try to find a copy of our value.
        for (GLuint i = 1; i <= mDepth; ++i)
        {
            GLuint lookIndex = (killIndex + i) % mDepth;
            if ((mHash[lookIndex] == hash) && (mAttr[lookIndex] == key))
            {
                if (i < mDepth)
                    ++mHits;
                else
                    ++mMisses;
                return mIndex[lookIndex];
            }
        }

        assert(false && "This is unreachable.");
        return 0;
    }
开发者ID:prabindh,项目名称:openswr,代码行数:40,代码来源:oglstate.hpp

示例9: count

	static int count(value_type const& i) {
		return static_cast<int>(i.size());
	}
开发者ID:Ochieng,项目名称:AnimationMaker,代码行数:3,代码来源:graphics_loader_base.hpp

示例10: size

    /** Returns the payload size of the body

        When this body is used with @ref message::prepare_payload,
        the Content-Length will be set to the payload size, and
        any chunked Transfer-Encoding will be removed.
    */
    static
    std::uint64_t
    size(value_type const& v)
    {
        return v.size();
    }
开发者ID:osquery,项目名称:third-party,代码行数:12,代码来源:basic_dynamic_body.hpp

示例11: size

    /** Returns the payload size of the body

        When this body is used with @ref message::prepare_payload,
        the Content-Length will be set to the payload size, and
        any chunked Transfer-Encoding will be removed.
    */
    static
    std::uint64_t
    size(value_type const& body)
    {
        return body.size();
    }
开发者ID:CustomOrthopaedics,项目名称:OTS-Boost,代码行数:12,代码来源:span_body.hpp

示例12: size

 size_t size() const {
     return oneLineNotation.size();
 }
开发者ID:Mizuchi,项目名称:SBL,代码行数:3,代码来源:permutation.hpp

示例13: encodedLength

 static std::size_t encodedLength(value_type const& value)
 {
     return value.size();
 }
开发者ID:DouglasHeriot,项目名称:ember-plus,代码行数:4,代码来源:StdString.hpp

示例14: operator

 measured_type operator()(value_type p) const {
   measured_type m = algebra_type::identity();
   m.value1 = p->size();
   m.value2 = p->get_cached();
   return m;
 }
开发者ID:deepsea-inria,项目名称:chunkedseq,代码行数:6,代码来源:chunkedseq.hpp


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