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

C++ size_type函数代码示例

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

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



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

示例1: total_size_with_header

 size_type total_size_with_header() const
 {
    return get_rounded_size
             ( size_type(sizeof(Header))
          , size_type(::boost::container::container_detail::alignment_of<block_header<size_type> >::value))
         + total_size();
 }
开发者ID:13W,项目名称:icq-desktop,代码行数:7,代码来源:segment_manager_helper.hpp


示例2: invariants

XalanDOMString&
XalanDOMString::append(
            const char*     theString,
            size_type       theCount)
{
    invariants();

    const size_type     theLength =
            theCount == size_type(npos) ? length(theString) : theCount;

    if (theLength != 0)
    {
        if (empty() == true)
        {
            doTranscode(theString, theLength, theCount == size_type(npos), m_data, true);
        }
        else
        {
            XalanDOMCharVectorType  theTempVector(getMemoryManager());

            doTranscode(theString, theLength, theCount == size_type(npos), theTempVector, false);

            append(&*theTempVector.begin(), size_type(theTempVector.size()));
        }

        m_size = size_type(m_data.size()) - 1;
        assert(m_data.size() - 1 == m_size);
    }

    invariants();

    return *this;
}
开发者ID:apache,项目名称:xalan-c,代码行数:33,代码来源:XalanDOMString.cpp


示例3: ReadFrom

inline size_type ReadFrom(const Packed &count) {
	auto result = size_type();
	for (auto &element : (count | ranges::view::reverse)) {
		result <<= 8;
		result |= size_type(element);
	}
	return result;
}
开发者ID:Emadpres,项目名称:tdesktop,代码行数:8,代码来源:storage_cache_types.cpp


示例4: get_rounded_size

   static Header *to_first_header(block_header<size_type> *bheader)
   {  
      Header * hdr = 
         reinterpret_cast<Header*>(reinterpret_cast<char*>(bheader) - 
		 get_rounded_size(size_type(sizeof(Header)), size_type(::boost::alignment_of<block_header<size_type> >::value)));
      //Some sanity checks
      return hdr;
   }
开发者ID:AhriLove,项目名称:HeroWars,代码行数:8,代码来源:segment_manager_helper.hpp


示例5: int

void stat_channel::second_tick(int tick_interval_ms)
{
	int sample = int(size_type(m_counter) * 1000 / tick_interval_ms);
	TORRENT_ASSERT(sample >= 0);
	m_5_sec_average = size_type(m_5_sec_average) * 4 / 5 + sample / 5;
	m_30_sec_average = size_type(m_30_sec_average) * 29 / 30 + sample / 30;
	m_counter = 0;
}
开发者ID:EricMyers47,项目名称:OpenSpace,代码行数:8,代码来源:stat.cpp


示例6: int

void stat_channel::second_tick(int tick_interval_ms)
{
    int sample = int(size_type(m_counter) * 1000 / tick_interval_ms);
    LIBED2K_ASSERT(sample >= 0);
    m_samples.push_front(sample);
    m_samples.pop_back();
    m_5_sec_average = std::accumulate(m_samples.begin(), m_samples.begin() + 5, 0) / 5;
    //m_5_sec_average = size_type(m_5_sec_average) * 4 / 5 + sample / 5;
    m_30_sec_average = size_type(m_30_sec_average) * 29 / 30 + sample / 30;
    m_counter = 0;
}
开发者ID:ST3ALth,项目名称:libed2k,代码行数:11,代码来源:stat.cpp


示例7: theGuard

void
XalanOutputStream::flushBuffer()
{
    if (m_buffer.empty() == false)
    {
        CollectionClearGuard<BufferType>    theGuard(m_buffer);

        assert(size_type(m_buffer.size()) == m_buffer.size());

        doWrite(&*m_buffer.begin(), size_type(m_buffer.size()));
    }

    assert(m_buffer.empty() == true);
}
开发者ID:rherardi,项目名称:xml-xalan-c-src_1_10_0,代码行数:14,代码来源:XalanOutputStream.cpp


示例8:

void 
__vector__<_Tp, _Alloc>::_M_fill_insert(
				    iterator __position, 
				    size_type __n, const _Tp& __x) {
  if (__n != 0) {
    if (size_type(this->_M_end_of_storage._M_data - this->_M_finish) >= __n) {
      _Tp __x_copy = __x;
      const size_type __elems_after = this->_M_finish - __position;
      pointer __old_finish = this->_M_finish;
      if (__elems_after > __n) {
        __uninitialized_copy(this->_M_finish - __n, this->_M_finish, this->_M_finish, _IsPODType());
        this->_M_finish += __n;
        __copy_backward_ptrs(__position, __old_finish - __n, __old_finish, _TrivialAss());
        _STLP_STD::fill(__position, __position + __n, __x_copy);
      }
      else {
        uninitialized_fill_n(this->_M_finish, __n - __elems_after, __x_copy);
        this->_M_finish += __n - __elems_after;
        __uninitialized_copy(__position, __old_finish, this->_M_finish, _IsPODType());
        this->_M_finish += __elems_after;
        _STLP_STD::fill(__position, __old_finish, __x_copy);
      }
    }
    else 
      _M_insert_overflow(__position, __x, _IsPODType(), __n);
  }
}
开发者ID:Arkshine,项目名称:NS,代码行数:27,代码来源:_vector.c


示例9: SetDataFlags

void
nsTSubstring_CharT::Adopt( char_type* data, size_type length )
  {
    if (data)
      {
        ::ReleaseData(mData, mFlags);

        if (length == size_type(-1))
          length = char_traits::length(data);

        mData = data;
        mLength = length;
        SetDataFlags(F_TERMINATED | F_OWNED);

        STRING_STAT_INCREMENT(Adopt);
#ifdef NS_BUILD_REFCNT_LOGGING
        // Treat this as construction of a "StringAdopt" object for leak
        // tracking purposes.        
        NS_LogCtor(mData, "StringAdopt", 1);
#endif // NS_BUILD_REFCNT_LOGGING
      }
    else
      {
        SetIsVoid(true);
      }
  }
开发者ID:Tripleman,项目名称:mozilla-central,代码行数:26,代码来源:nsTSubstring.cpp


示例10: size_type

XalanDOMString&
XalanDOMString::append(
            const XalanDOMChar*     theString,
            size_type               theCount)
{
    const size_type     theLength =
            theCount == size_type(npos) ? length(theString) : theCount;

    if (theLength != 0)
    {
        if (m_data.empty() == true)
        {
            m_data.reserve(theLength + 1);

            m_data.insert(m_data.end(), theString, theString + theLength);

            m_data.push_back(0);

            m_size = theLength;

            assert(length() == theLength);
        }
        else
        {
            m_data.insert(getBackInsertIterator(), theString, theString + theLength);

            m_size += theCount;
        }
    }

    invariants();

    return *this;
}
开发者ID:apache,项目名称:xalan-c,代码行数:34,代码来源:XalanDOMString.cpp


示例11: cw_context

 cw_context()
     : tags( *this, "tags" ),
       blocks( *this, "blocks" ),
       counts_per_block( *this, "counts_per_block" ),
       counts( *this, "counts" ),
       red_counts( *this, "red_counts" ),
       steps( *this, "counter" ),
       reduce( NULL )
 {
     // here we wire the graph/reduction
     reduce = CnC::make_reduce_graph( *this,            // context
                                      "reduce",         // name
                                      counts_per_block, // input collection
                                      red_counts,       // number of items per reduction
                                      counts,           // the final result for each reduction
                                      std::plus<size_type>(), // the reduction operation
                                      size_type(0),     // identity element
                                      // we use a lambda as the selector
                                      // it maps the item to the reduction identified by t.second (the string)
                                      // e.g. it reduces over all blocks
                                      []( const tag_type & t, std::string & _s )->bool{_s=t.second;return true;} );
     tags.prescribes( steps, *this );
     steps.consumes( blocks );
     steps.produces( counts_per_block );
     //CnC::debug::trace( *reduce, 3 );
 }
开发者ID:baskarang,项目名称:icnc,代码行数:26,代码来源:count_words.cpp


示例12: __NodeActivated

void DrizzleIntegrationInterface::__NodeActivated( TreeBox& sender, TreeBox::Node& node, int col )
{
   int index = sender.ChildIndex( &node );
   if ( index < 0 || size_type( index ) >= m_instance.p_inputData.Length() )
      throw Error( "DrizzleIntegrationInterface: *Warning* Corrupted interface structures" );

   DrizzleIntegrationInstance::DataItem& item = m_instance.p_inputData[index];

   switch ( col )
   {
   case 0:
      break;
   case 1:
      item.enabled = !item.enabled;
      UpdateInputDataItem( index );
      break;
   case 2:
      {
         /*
          * ### TODO: Open drizzle data file and show a summary of drizzle data.
          */
      }
      break;
   }
}
开发者ID:morserover,项目名称:PCL,代码行数:25,代码来源:DrizzleIntegrationInterface.cpp


示例13: QT_TRANSLATE_NOOP

QString StaticHelpers::toKbMbGb(size_type size, bool isSpped)
{
	float val = size;
	char* SizeSuffix[] =
	{
		QT_TRANSLATE_NOOP("Torrent", " B"),
		QT_TRANSLATE_NOOP("Torrent", " Kb"),
		QT_TRANSLATE_NOOP("Torrent", " Mb"),
		QT_TRANSLATE_NOOP("Torrent", " Gb"),
		QT_TRANSLATE_NOOP("Torrent", " Tb"),
		QT_TRANSLATE_NOOP("Torrent", " Pb"),
		QT_TRANSLATE_NOOP("Torrent", " Eb"),
		QT_TRANSLATE_NOOP("Torrent", " Zb")
	};
	char* SpeedSuffix[] =
	{
		QT_TRANSLATE_NOOP("Torrent", " B\\s"),
		QT_TRANSLATE_NOOP("Torrent", " Kb\\s"),
		QT_TRANSLATE_NOOP("Torrent", " Mb\\s"),
		QT_TRANSLATE_NOOP("Torrent", " Gb\\s"),
		QT_TRANSLATE_NOOP("Torrent", " Tb\\s"),
		QT_TRANSLATE_NOOP("Torrent", " Pb\\s"),
		QT_TRANSLATE_NOOP("Torrent", " Eb\\s"),
		QT_TRANSLATE_NOOP("Torrent", " Zb\\s")
	};
	int i = 0;
	float dblSByte = val;

	if (size > KbInt)
	{
		for (i; size_type(val / KbInt) > 0; i++, val /= KbInt)
		{
			dblSByte = val / KbFloat;
		}
	}

	float fractpart, intpart;
	fractpart = modff(dblSByte, &intpart);
	QString str;

	if (fractpart < FLT_EPSILON)
	{
		str = QString::number(int(dblSByte));
	}
	else
	{
		str = QString::number(dblSByte, 'f', i == 0 ? 0 : 2);
	}

	if (isSpped)
	{
		str.append(qApp->translate("Torrent", SpeedSuffix[i]));
	}
	else
	{
		str.append(qApp->translate("Torrent", SizeSuffix[i]));
	}

	return str;
}
开发者ID:solonix,项目名称:CuteTorrent,代码行数:60,代码来源:StaticHelpers.cpp


示例14: STRUCT_INFO_BEGIN

static const struct_info_t *memory_manager_type_is_struct  (const type_t *self)
  {
    STRUCT_INFO_BEGIN(memory_manager);

    /* typed_t type */
    STRUCT_INFO_RADD(typed_type(), type);

    /* manager_mmalloc_fun_t  mmalloc;  */
    /* manager_mfree_fun_t    mfree;    */
    /* manager_mrealloc_fun_t mrealloc; */
    /* manager_mcalloc_fun_t  mcalloc;  */
    STRUCT_INFO_RADD(funp_type(), mmalloc);
    STRUCT_INFO_RADD(funp_type(), mfree);
    STRUCT_INFO_RADD(funp_type(), mrealloc);
    STRUCT_INFO_RADD(funp_type(), mcalloc);

    /* manager_on_oom_fun_t on_oom; */
    /* manager_on_err_fun_t on_err; */
    STRUCT_INFO_RADD(funp_type(), on_oom);
    STRUCT_INFO_RADD(funp_type(), on_err);

    /* void   *state; */
    STRUCT_INFO_RADD(objp_type(),  state);

    /* size_t  state_size; */
    STRUCT_INFO_RADD(size_type(),  state_size);

    STRUCT_INFO_DONE();
  }
开发者ID:bairyn,项目名称:opencurry,代码行数:29,代码来源:type_base_memory_manager.c


示例15: switch

bool EA::IO::FixedMemoryStream::SetPosition( off_type nPosition, PositionType positionType )
{
    switch (positionType)
    {
        case kPositionTypeBegin:
            EA_ASSERT(nPosition >= 0);
            mnPosition = (size_type)nPosition; // We deal with negative positions below.
            break;

        case kPositionTypeCurrent:
            mnPosition = mnPosition + (size_type)nPosition;  // We have a signed/unsigned match, but the math should work anyway.
            break;

        case kPositionTypeEnd:
            mnPosition = mnSize + nPosition; // We deal with invalid resulting positions below.
            break;
    }

    // Deal with out-of-bounds situations that result from the above.
    if (mnPosition > mnSize)
    {
        EA_ASSERT( mnPosition < (size_type(-1) / 2) );
        mnPosition = mnSize;
        return false;
    }

    return true;
}
开发者ID:GRGSIBERIA,项目名称:EAWebKit,代码行数:28,代码来源:EAStreamFixedMemory.cpp


示例16: assert

XalanDOMString::size_type
XalanDOMString::length(const char*  theString)
{
    assert(theString != 0);

#if defined(XALAN_STRICT_ANSI_HEADERS)
    assert(std::strlen(theString) < size_type(npos));

    return size_type(std::strlen(theString));
#else
    assert(strlen(theString) < size_type(npos));

    return size_type(strlen(theString));
#endif

}
开发者ID:apache,项目名称:xalan-c,代码行数:16,代码来源:XalanDOMString.cpp


示例17: temp

void
nsTSubstring_CharT::Replace( index_type cutStart, size_type cutLength, const char_type* data, size_type length )
  {
      // unfortunately, some callers pass null :-(
    if (!data)
      {
        length = 0;
      }
    else
      {
        if (length == size_type(-1))
          length = char_traits::length(data);

        if (IsDependentOn(data, data + length))
          {
            nsTAutoString_CharT temp(data, length);
            Replace(cutStart, cutLength, temp);
            return;
          }
      }

    cutStart = XPCOM_MIN(cutStart, Length());

    if (ReplacePrep(cutStart, cutLength, length) && length > 0)
      char_traits::copy(mData + cutStart, data, length);
  }
开发者ID:Tripleman,项目名称:mozilla-central,代码行数:26,代码来源:nsTSubstring.cpp


示例18: __InputImages_NodeActivated

void HDRCompositionInterface::__InputImages_NodeActivated( TreeBox& sender, TreeBox::Node& node, int col )
{
   int index = sender.ChildIndex( &node );
   if ( index < 0 || size_type( index ) >= instance.images.Length() )
      throw Error( "HDRCompositionInterface: *Warning* Corrupted interface structures" );

   HDRCompositionInstance::ImageItem& item = instance.images[index];

   switch ( col )
   {
   case 0:
      break;
   case 1:
      item.enabled = !item.enabled;
      UpdateInputImagesItem( index );
      break;
   case 2:
      {
         Array<ImageWindow> w = ImageWindow::Open( item.path );
         for ( Array<ImageWindow>::iterator i = w.Begin(); i != w.End(); ++i )
            i->Show();
      }
      break;
   }
}
开发者ID:SunGong1993,项目名称:PCL,代码行数:25,代码来源:HDRCompositionInterface.cpp


示例19: __TargetImages_NodeActivated

void GradientsMergeMosaicInterface::__TargetImages_NodeActivated( TreeBox& sender, TreeBox::Node& node, int col )
{
   int index = sender.ChildIndex( &node );
   if ( index < 0 || size_type( index ) >= instance.targetFrames.Length() )
      throw Error( "GradientsMergeMosaicInterface: *Warning* Corrupted interface structures" );

   GradientsMergeMosaicInstance::ImageItem& item = instance.targetFrames[index];

   switch ( col )
   {
   case 0:
      // Activate the item's index number: ignore.
      break;
   case 1:
      // Activate the item's checkmark: toggle item's enabled state.
      item.enabled = !item.enabled;
      UpdateTargetImageItem( index );
      break;
   case 2:
      {
         // Activate the item's path: open the image.
         Array<ImageWindow> w = ImageWindow::Open( item.path );
         for ( Array<ImageWindow>::iterator i = w.Begin(); i != w.End(); ++i )
            i->Show();
      }
      break;
   }
}
开发者ID:SunGong1993,项目名称:PCL,代码行数:28,代码来源:GradientsMergeMosaicInterface.cpp


示例20: size_type

   // EXTRA MEMBER FUNCTIONS FOR DEBUG PRINTING
   void p_queue::print_tree(const char message[], size_type i) const
   // Pre:  (none)
   // Post: If the message is non-empty, it has first been written to
   //       cout. After that, the portion of the heap with root at
   //       node i has been written to the screen. Each node's data
   //       is indented 4*d, where d is the depth of the node.
   //       NOTE: The default argument for message is the empty string,
   //             and the default argument for i is zero. For example,
   //             to print the entire tree of a p_queue p, with a
   //             message of "The tree:", you can call:
   //                p.print_tree("The tree:");
   //             This call uses the default argument i=0, which prints
   //             the whole tree.
   {
      const char NO_MESSAGE[] = "";
      size_type depth;

      if (message[0] != '\0')
         cout << message << endl;

      if (i >= used)
         cout << "(EMPTY)" << endl;
      else
      {
         depth = size_type( log( double(i+1) ) / log(2.0) + 0.1 );
         if (2*i + 2 < used)
            print_tree(NO_MESSAGE, 2*i + 2);
         cout << setw(depth*3) << "";
         cout << heap[i].data;
         cout << '(' << heap[i].priority << ')' << endl;
         if (2*i + 1 < used)
            print_tree(NO_MESSAGE, 2*i + 1);
      }
   }
开发者ID:Saamy88,项目名称:Data-Structures,代码行数:35,代码来源:DPQueue.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ sizearray函数代码示例发布时间:2022-05-30
下一篇:
C++ size_t函数代码示例发布时间: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