本文整理汇总了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;
}
示例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;
}
}
示例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);
}
}
}
示例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
);
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例9: count
static int count(value_type const& i) {
return static_cast<int>(i.size());
}
示例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();
}
示例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();
}
示例12: size
size_t size() const {
return oneLineNotation.size();
}
示例13: encodedLength
static std::size_t encodedLength(value_type const& value)
{
return value.size();
}
示例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;
}