本文整理汇总了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;
}
示例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;
}
示例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
}
示例4: Get
const IdentifierInfo * Get(
const char * name
) const {
auto it = _identifiers.find(name);
if (it == _identifiers.cend()) return nullptr;
return it->second;
}
示例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();
}
示例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());
}
示例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;
}
示例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;
}
示例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;
}
示例10: removeTexture
bool removeTexture(const sf::String & alias)
{
ConstTextureIterator texture = textures.find(alias);
if (texture != textures.cend())
{
textures.erase(texture);
return true;
}
return false;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}