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


C++ Container::Get方法代码示例

本文整理汇总了C++中Container::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ Container::Get方法的具体用法?C++ Container::Get怎么用?C++ Container::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Container的用法示例。


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

示例1: Interpret_

/**
 * Perform an interpret call where we want to return a container that 
 * contains flattened containers (flattened by 1).
 *
 * @param environment Not used.
 * @param parms The parameters passed to the builtin function.
 * @param additional_parameter Not used.
 * @return a container of elements.
 *
 * @version
 * - JR Lewis       2012.06.01
 *   - Initial version.
 */
Element ConcatBuiltinImplementation::Interpret_( Environment& /* environment */ 
                                               , std::vector<Element> const& parms
                                               , Element const& /* additional_parameter */ )
{
    typedef std::vector<Element>::const_iterator Iterator;

    Container C;

    Iterator iter = parms.begin();
    Iterator end = parms.end();
    for(; iter != end; ++iter)
    {
        bool isAContainer  = false;
        Container current = CastToContainer(*iter, isAContainer);
        if (isAContainer)
        {
            int const NUMBER_OF_ELEMENTS = current.NumberOfElements();
            for(int i=0; i<NUMBER_OF_ELEMENTS; ++i)
            {
                C.Add(current.Get(i));
            }
        } 
        else
        {
            C.Add(*iter);
        }
    }

    return C;
}
开发者ID:signatal,项目名称:strine,代码行数:43,代码来源:concatbuiltinimplementation.cpp

示例2: RecurseContainer

void Visitor::RecurseContainer(Container const& container)
{
    int const SIZE = container.NumberOfElements();
    for(int i=0; i<SIZE; ++i)
    {
        Visit(container.Get(i));
    } 
}
开发者ID:signatal,项目名称:strine,代码行数:8,代码来源:visitor.cpp

示例3: InterpretContainer_

 Element InterpretContainer_(Container container)
 {
     Element out = Nil();
     if (container.NumberOfElements() > 0)
     {
         out = container.Get(0);
     } 
     return out;
 } 
开发者ID:signatal,项目名称:codeography,代码行数:9,代码来源:containercapability.cpp

示例4:

    bool PropertyRestrictions<Key, KeyValue, Container>::Qualifies( const Container& rPropertiesContainer )
    {
        bool qualifies = true;

        // individual has to have one of these properties
        for( Container& container : _restrictions)
        {
            qualifies = false;
            bool meets_property_restriction_criteria = true;
            for( auto kv : container )
            {
                if( rPropertiesContainer.Contains( kv ) )
                {
                    LOG_DEBUG_F( "Partial property restriction: constraint is %s.\n", kv.ToString().c_str() );
                    continue; // we're good
                }
                else
                {
                    meets_property_restriction_criteria = false;
#ifdef WIN32
                    LOG_DEBUG_F( "Person does not get the intervention because the allowed property is %s and the person is %s.\n", 
                                 kv.ToString().c_str(), rPropertiesContainer.Get( kv.GetKey<Key>() ).ToString().c_str() );
#endif
                    break;
                }
            }
            // If verified, we're done since these are OR-ed together
            if( meets_property_restriction_criteria )
            {
                qualifies = true;
                LOG_DEBUG_F( "Individual meets at least 1 of the OR-ed together property restriction conditions. Not checking the rest.\n" );
                break;
            }
        }

        return qualifies;
    }
开发者ID:InstituteforDiseaseModeling,项目名称:EMOD,代码行数:37,代码来源:PropertyRestrictions.cpp


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