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


C++ any::empty方法代码示例

本文整理汇总了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);
   }
开发者ID:haripandey,项目名称:trilinos,代码行数:12,代码来源:Teuchos_any.hpp

示例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;
}
开发者ID:avilleret,项目名称:Gem,代码行数:29,代码来源:State.cpp

示例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");
}
开发者ID:untgames,项目名称:funner,代码行数:8,代码来源:any.cpp

示例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");
}
开发者ID:untgames,项目名称:funner,代码行数:10,代码来源:any.cpp

示例5: is_empty

bool is_empty(any<has_empty<bool(), const _self>, const _self&> x) {
    return x.empty();
}
开发者ID:LancelotGHX,项目名称:Simula,代码行数:3,代码来源:basic.cpp


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