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


C++ size_type函数代码示例

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


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


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