Click here to Skip to main content
15,886,518 members
Articles / Programming Languages / C++

An Introduction For How to Insert your Own Custom Objects Inside a std:::set

Rate me:
Please Sign up or sign in to vote.
4.52/5 (26 votes)
6 May 2009CPOL3 min read 54.6K   102   7  
An Introduction for how to insert your own custom objects inside a std:::set
/* 
 * File:   MyComparator.hpp
 * Author: Administrator
 *
 * Created on May 6, 2009, 5:11 PM
 */

#ifndef _MYCOMPARATOR_HPP
#define	_MYCOMPARATOR_HPP
#include "MyType.hpp"
template <typename T>
class MyComparator{
public:
    bool operator() (const T& t1, const T& t2) const{
        return t1.getValue()<t2.getValue();
    }
};

#endif	/* _MYCOMPARATOR_HPP */

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Rebaca Technologies
India India
int main(){
while(!isSleeping())
{
write_code();
}
return 0;
}

Comments and Discussions