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


C++ map::cend方法代码示例

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


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

示例1:

/**
 * Cartesian product
 */
std::vector<box> box_factory::cartesian_product(std::map<std::string, std::vector<capd::interval>> m)
{
    // checking if the map is empty
    if(m.empty())
    {
        return vector<box>{};
    }

    unsigned long size = 1;
    for(auto it = m.cbegin(); it != m.cend(); it++)
    {
        size *= (it->second).size();
    }

    std::vector<box> product;
    for(unsigned long i = 0; i < size; i++)
    {
        unsigned long index = i;
        std::map<std::string, capd::interval> tmp_m;
        for(auto it1 = m.cbegin(); it1 != m.cend(); it1++)
        {
            unsigned long mult = 1;
            for(auto it2 = --m.cend(); it2 != it1; it2--)
            {
                mult *= (it2->second).size();
            }
            unsigned long tmp_index = index / mult;
            tmp_m.insert(make_pair(it1->first, (it1->second).at(tmp_index)));
            index -= tmp_index * mult;
        }
        product.push_back(box(tmp_m));
    }
    return product;
}
开发者ID:danbryce,项目名称:probreach,代码行数:37,代码来源:box_factory.cpp

示例2: GetErrorMessageText

std::wstring CTestCaseData::GetErrorMessageText() const
{
  static std::wstring res;
  res = L"unknown message";
  auto it = mapEncodingNames.find(iEncoding);
  assert(it != mapEncodingNames.cend());
  if (it != mapEncodingNames.cend())
  {
    res = it->second;
  }
  return res;
}
开发者ID:ProgerXP,项目名称:Notepad2e,代码行数:12,代码来源:TextEncodingTestCaseData.cpp

示例3: print

void print(const std::map<T, P>& container) {
    #ifdef _DEBUG

    for (auto it = container.cbegin(); it != container.cend();) {
        std::cerr << it->first << ": " << it->second;
        it++;
        if (it != container.cend())
            std::cerr << ", ";
    }

    #endif
}
开发者ID:s-mx,项目名称:Archivator.-smx,代码行数:12,代码来源:compression.cpp

示例4: Get

		const IdentifierInfo * Get(
			const char * name
			) const {
				auto it = _identifiers.find(name);
				if (it == _identifiers.cend()) return nullptr;
				return it->second;
			}
开发者ID:nova-compiler,项目名称:n-interpreter,代码行数:7,代码来源:context.hpp

示例5: path

	// path lookup within registry
	Path path( const std::string &key )
	{
		std::map<std::string, Path>::const_iterator it = g_pathRegistry.find( key );
		if( it != g_pathRegistry.cend() )
			return it->second;
		return Path();
	}
开发者ID:dkoerner,项目名称:base,代码行数:8,代码来源:Path.cpp

示例6: dump_as_list

 void dump_as_list(const int fd) final {
     using t = typename std::map<TId, TValue>::value_type;
     std::vector<t> v;
     v.reserve(m_elements.size());
     std::copy(m_elements.cbegin(), m_elements.cend(), std::back_inserter(v));
     osmium::io::detail::reliable_write(fd, reinterpret_cast<const char*>(v.data()), sizeof(t) * v.size());
 }
开发者ID:hydrays,项目名称:osrm-backend,代码行数:7,代码来源:sparse_mem_map.hpp

示例7:

std::vector<std::tuple<K, V>> to_vec(std::map<K, V> m)
{
    std::vector<std::tuple<K, V>> vec;
    for (auto it = m.cbegin(); it != m.cend(); ++it) {
        vec.emplace_back(std::make_tuple(it->first, it->second));
    }
    return vec;
}
开发者ID:ma7ch,项目名称:cpp_playground,代码行数:8,代码来源:tolist.cpp

示例8: main

int main(int argc, char** argv) {
    SkCommandLineFlags::SetUsage(
            "Usage: get_images_from_skps -s <dir of skps> -o <dir for output images> --testDecode "
            "-j <output JSON path>\n");

    SkCommandLineFlags::Parse(argc, argv);
    const char* inputs = FLAGS_skps[0];
    gOutputDir = FLAGS_out[0];

    if (!sk_isdir(inputs) || !sk_isdir(gOutputDir)) {
        SkCommandLineFlags::PrintUsage();
        return 1;
    }

    SkOSFile::Iter iter(inputs, "skp");
    for (SkString file; iter.next(&file); ) {
        SkAutoTDelete<SkStream> stream =
                SkStream::NewFromFile(SkOSPath::Join(inputs, file.c_str()).c_str());
        sk_sp<SkPicture> picture(SkPicture::MakeFromStream(stream));

        SkDynamicMemoryWStream scratch;
        Sniffer sniff(file.c_str());
        picture->serialize(&scratch, &sniff);
    }
    int totalUnknowns = 0;
    /**
     JSON results are written out in the following format:
     {
       "failures": {
         "skp1": 12,
         "skp4": 2,
         ...
       },
       "totalFailures": 32,
       "totalSuccesses": 21,
     }
     */
    Json::Value fRoot;
    for(auto it = gSkpToUnknownCount.cbegin(); it != gSkpToUnknownCount.cend(); ++it)
    {
        SkDebugf("%s %d\n", it->first.c_str(), it->second);
        totalUnknowns += it->second;
        fRoot["failures"][it->first.c_str()] = it->second;
    }
    SkDebugf("%d known, %d unknown\n", gKnown, totalUnknowns);
    fRoot["totalFailures"] = totalUnknowns;
    fRoot["totalSuccesses"] = gKnown;
    if (totalUnknowns > 0) {
        if (!FLAGS_failuresJsonPath.isEmpty()) {
            SkDebugf("Writing failures to %s\n", FLAGS_failuresJsonPath[0]);
            SkFILEWStream stream(FLAGS_failuresJsonPath[0]);
            stream.writeText(Json::StyledWriter().write(fRoot).c_str());
            stream.flush();
        }
        return -1;
    }
    return 0;
}
开发者ID:merryma,项目名称:skia,代码行数:58,代码来源:get_images_from_skps.cpp

示例9: convert

 static inline bbb::json convert(std::map<std::string, type, comp, alloc> &table)
 {
     std::map<std::string, bbb::json> json_map;
     
     for(auto it = table.cbegin(); it != table.cend(); ++it) {
         json_map.emplace(it->first, std::move(convert(it->second)));
     }
     
     return json_map;
 }
开发者ID:2bbb,项目名称:ofxJsonUtils,代码行数:10,代码来源:convert.hpp

示例10: removeTexture

		bool      removeTexture(const sf::String & alias)
		{
			ConstTextureIterator texture = textures.find(alias);
			if (texture != textures.cend())
			{
				textures.erase(texture);
				return true;
			}
			return false;
		}
开发者ID:DeMoully,项目名称:SFML_Extensions,代码行数:10,代码来源:TextureHandler.hpp

示例11: removeFont

		bool removeFont(const sf::String & fontAlias)
		{
			std::map<sf::String, sf::Font>::const_iterator font = fonts.find(fontAlias);
			if (font != fonts.cend())
			{
				fonts.erase(font);
				return true;
			}
			return false;
		}
开发者ID:DeMoully,项目名称:SFML_Extensions,代码行数:10,代码来源:FontHandler.hpp

示例12: getScraperList

std::vector<std::string> getScraperList()
{
	std::vector<std::string> list;
	for(auto it = scraper_request_funcs.cbegin(); it != scraper_request_funcs.cend(); it++)
	{
		list.push_back(it->first);
	}

	return list;
}
开发者ID:RetroPie,项目名称:EmulationStation,代码行数:10,代码来源:Scraper.cpp

示例13: get_matching_groups

static names_vec get_matching_groups( nameFlags searchFlags )
{
    names_vec matching_groups;
    for( auto it = names.cbegin(), end = names.cend(); it != end; ++it ) {
        const nameFlags type = it->first;
        if( ( searchFlags & type ) == searchFlags ) {
            matching_groups.push_back( it );
        }
    }
    return matching_groups;
}
开发者ID:Barhandar,项目名称:Cataclysm-DDA,代码行数:11,代码来源:name.cpp

示例14: while

const std::string &name_by_dt( const damage_type &dt )
{
    auto iter = dt_map.cbegin();
    while( iter != dt_map.cend() ) {
        if( iter->second == dt ) {
            return iter->first;
        }
        iter++;
    }
    static const std::string err_msg( "dt_not_found" );
    return err_msg;
}
开发者ID:tycho,项目名称:Cataclysm-DDA,代码行数:12,代码来源:damage.cpp

示例15: vertical_sum_rec

std::vector<int> find_vertical_sum(Node* node) {
    void vertical_sum_rec(Node* node, int index);

    vertical_sum_rec(node, 0);

    std::vector<int> result;
    // this is still not supported
    //for (auto it:vert_sum) {
    for (auto it = vert_sum.cbegin(); it != vert_sum.cend(); ++it)
        result.push_back(it->second);

    return result;
}
开发者ID:Mareeswaran38,项目名称:Problem-Solving,代码行数:13,代码来源:max2_vertical_sum_binary_tree.cpp


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