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


C++ map_t::find方法代码示例

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


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

示例1: go

            void go( bool construct )
            {
                typedef std::pair<std::string,int> key_t;
                typedef std::map<key_t, int> map_t;

                static map_t map;
                key_t id = key_t( file, line );
                map_t::iterator it = map.find( id );

                if( construct )
                {
                    compiled = ( it != map.end() );
                    if( !compiled )
                    {
                        static int list = 0;
                        list++;
                        map.insert( std::pair<key_t,int>( id, list) );
                        glNewList( list, GL_COMPILE );
                    }
                }
                else
                {
                    int list = it->second;
                    if( !compiled )
                    {
                        glEndList();
                        //std::cout << "compiled list #" << list << std::endl;
                    }
                    //std::cout << "calling list #" << list << std::endl;
                    glCallList( list );
                }
            }
开发者ID:r-lyeh,项目名称:eve,代码行数:32,代码来源:lists.hpp

示例2: touch

 /** Mark an element as recently used. */
 void touch (const key_type& k)
 {
     auto found (map_.find(k));
     assert(found != map_.end());
     if (found != map_.end())
         list_.splice(list_.begin(), list_, found->second);
 }
开发者ID:friederschueler,项目名称:hexahedra,代码行数:8,代码来源:lru_cache.hpp

示例3: found

    boost::optional<mapped_type&> try_get (const key_type& k) const
    {
        auto found (map_.find(k));
        if (found == map_.end())
            return boost::optional<mapped_type&>();

        return found->second->second;
    }
开发者ID:friederschueler,项目名称:hexahedra,代码行数:8,代码来源:lru_cache.hpp

示例4: init

	void init()
	{
		map_t::iterator it = gMap.find(mKey);
		if (it == gMap.end()) {
			throw std::runtime_error("uninitialized mongo_stream sink");
		}
		mObject = it->second;
	}
开发者ID:ignatz,项目名称:boost_mongo,代码行数:8,代码来源:mongo_stream.hpp

示例5: remove

    /** Remove an element from the cache. */
    void remove (const key_type& k)
    {
        auto found (map_.find(k));
        if (found == map_.end())
            return;

        list_.erase(found->second);
        map_.erase(found);
        --size_;
    }
开发者ID:friederschueler,项目名称:hexahedra,代码行数:11,代码来源:lru_cache.hpp

示例6: check_and_add_output_file

static void check_and_add_output_file(Module* NewMod, const std::string& str)
{
    typedef std::map<std::string, Module*> map_t;
    static map_t files;

    map_t::iterator i = files.find(str);
    if (i != files.end()) {
        Module* ThisMod = i->second;
        error(Loc(), "Output file '%s' for module '%s' collides with previous module '%s'. See the -oq option",
            str.c_str(), NewMod->toPrettyChars(), ThisMod->toPrettyChars());
        fatal();
    }
    files.insert(std::make_pair(str, NewMod));
}
开发者ID:doniexun,项目名称:ldc,代码行数:14,代码来源:module.cpp

示例7: map_string

const char* name_t::map_string(const char* str, std::size_t hash) {
    typedef std::unordered_map<std::size_t, const char*> map_t;
    typedef std::lock_guard<std::mutex> lock_t;

    static std::mutex sync_s;

    lock_t lock(sync_s);

    static adobe::unique_string_pool_t pool_s;
    static map_t map_s;
    map_t::const_iterator found(map_s.find(hash));

    return found == map_s.end() ? map_s.emplace(hash, pool_s.add(str)).first->second
                                : found->second;
}
开发者ID:BobArcher,项目名称:adobe_source_libraries,代码行数:15,代码来源:name.cpp

示例8: Exception

        //Returns a reference to the resource associated with the file name 'key' if it exists in memory.
        //Otherwise it loads the texture into memory, and returns a reference to the the resource.
        T &Load(key_type const &key) noexcept(false)
        {
            map_i i = m_map.find(key);
            if(i != m_map.end())
            {
                return *i->second.get(); //return resource if exists
            }

            //else, load resource
            ptr_t p {onLoadResource(key)};
            if(p.get() == NULL)
            {
                throw Exception(std::string("Error loading Image at ") + key);
            }

            m_map.insert(std::make_pair(key, std::move(p)));
            return *m_map[key].get();
        }
开发者ID:MiiNiPaa,项目名称:ChessPlusPlus,代码行数:20,代码来源:ResourceManager.hpp

示例9: set_fields

		void set_fields(doid_t do_id, const map_t &fields)
		{
			m_log->trace() << "Setting fields on obj-" << do_id << endl;

			YAML::Node document;
			if(!load(do_id, document))
			{
				return;
			}

			// Get the fields from the file that are not being updated
			const Class* dcc = g_dcf->get_class_by_name(document["class"].as<string>());
			ObjectData dbo(dcc->get_id());
			YAML::Node existing = document["fields"];
			for(auto it = existing.begin(); it != existing.end(); ++it)
			{
				const Field* field = dcc->get_field_by_name(it->first.as<string>());
				if(!field)
				{
					m_log->warning() << "Field '" << it->first.as<string>()
					                 << "', loaded from '" << filename(do_id)
					                 << "', does not exist." << endl;
					continue;
				}

				auto found = fields.find(field);
				if(found == fields.end())
				{
					vector<uint8_t> value = read_yaml_field(field, it->second, do_id);
					if(value.size() > 0)
					{
						dbo.fields[field] = value;
					}
				}
			}

			// Add in the fields that are being updated:
			for(auto it = fields.begin(); it != fields.end(); ++it)
			{
				dbo.fields[it->first] = it->second;
			}

			write_yaml_object(do_id, dcc, dbo);
		}
开发者ID:Echocage,项目名称:Astron,代码行数:44,代码来源:YAMLDatabase.cpp

示例10:

 ///parameters class-like element access
 _object const & operator[](std::string const & key) const {
  auto it = object_map.find(key);
  if ( it== object_map.end()) TRIQS_RUNTIME_ERROR<<"Key : "<< key<< " not found";
  return it->second;
 }
开发者ID:EBRUDU1,项目名称:triqs,代码行数:6,代码来源:defaults.hpp

示例11: has_key

 bool has_key(std::string const & key) const { return object_map.find(key) != object_map.end();}
开发者ID:EBRUDU1,项目名称:triqs,代码行数:1,代码来源:defaults.hpp

示例12: Free

 //Deletes the entry of a key in the resource map.
 //This will call deleter_type to deallocate the resource from memory as well.
 void Free(key_type const &key) noexcept
 {
     map_i i = m_map.find(key);
     m_map.erase(i);
 }
开发者ID:MiiNiPaa,项目名称:ChessPlusPlus,代码行数:7,代码来源:ResourceManager.hpp

示例13: find

 // find
 typename map_t::const_iterator find(const KEY_T& key) const {
     class map_t::const_iterator itr = map->find(key);
     return itr;
 }
开发者ID:Beman,项目名称:btree_test,代码行数:5,代码来源:map_btree.hpp


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