本文整理汇总了C++中any::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ any::empty方法的具体用法?C++ any::empty怎么用?C++ any::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类any
的用法示例。
在下文中一共展示了any::empty方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: same
//! \brief Return if two any objects are the same or not.
bool same( const any &other ) const
{
if( this->empty() && other.empty() )
return true;
else if( this->empty() && !other.empty() )
return false;
else if( !this->empty() && other.empty() )
return false;
// !this->empty() && !other.empty()
return content->same(*other.content);
}
示例2: set
/* set a named property */
bool GemState::set(const GemState::key_t key, any value) {
if(value.empty()) {
data->data.erase(key);
return false;
}
/* wrapper for DEPRECATED access to member variables */
if(1) {
try {
switch(key) {
case(_DIRTY): dirty=gem::any_cast<bool>(value); break;
case(_PIX): image=gem::any_cast<pixBlock*>(value); break;
case(_GL_TEX_NUMCOORDS): numTexCoords=gem::any_cast<int>(value); break;
case(_GL_TEX_COORDS): texCoords=gem::any_cast<TexCoord*>(value); break;
case(_GL_LIGHTING): lighting=gem::any_cast<bool>(value); break;
case(_GL_SMOOTH): smooth=gem::any_cast<bool>(value); break;
case(_GL_TEX_TYPE): texture=gem::any_cast<int>(value); break;
case(_GL_TEX_UNITS): multiTexUnits=gem::any_cast<int>(value); break;
case(_TIMING_TICK): tickTime=gem::any_cast<float>(value); break;
case(_GL_DRAWTYPE): drawType=gem::any_cast<GLenum>(value); break;
case(_GL_DISPLAYLIST): inDisplayList=gem::any_cast<bool>(value); break;
default: break;
}
} CATCH_ANY(key);
}
data->data[key]=value;
return true;
}
示例3: test_default_ctor
void test_default_ctor()
{
const any value;
check_true(value.empty(), "empty");
check_null(any_cast<int>(&value), "any_cast<int>");
check_equal(value.type(), typeid(void), "type");
}
示例4: test_null_copying
void test_null_copying()
{
const any null;
any copied = null, assigned;
assigned = null;
check_true(null.empty(), "empty on null");
check_true(copied.empty(), "empty on copied");
check_true(assigned.empty(), "empty on copied");
}
示例5: is_empty
bool is_empty(any<has_empty<bool(), const _self>, const _self&> x) {
return x.empty();
}