Skip to content

How to overcome strictly weakly ordered for sets and maps #59

Open
@MFaisalZaki

Description

@MFaisalZaki

I have this code snippet

#include <iostream>
#include <string>
#include <set>
#include <map>

int main() {
    std::set<std::string> std_section_names;
	std_section_names.insert(".text");
	std_section_names.insert(".itext");
	
    // ---- 
	std::map<std::string, double> pe_attr = {
		{"instructionsCount", 0.0},
	};
    return 0;
}

Where I created a set of strings and a map with string to double in order to count frequency. However, the CTR57-CPP hits with this message

Comparator 'std::less<basic_string<char, char_traits<char>, allocator<char>>>' used on container or sorting algorithm that is not strictly weakly ordered 
```. 

I understand the issue very well, yet I don't know how to fix it properly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions