#include <locale>
#include <iostream>

using namespace std;


/// collate<char> colc;


template<typename C>
class My_collate : public collate<C>
{
public:
    explicit My_collate(size_t r = 0) :
        collate<C> {r}
    {
    }
};

My_collate<char> mcolc;


void print(const string& s1, const string& s2,
           const int& rslt)
{
    string srslt {};

    switch(rslt)
    {
    case 0:
        srslt = "equal";
        break;

    case 1:
        srslt = "s1 > s2";
        break;


    case -1:
        srslt = "s1 < s2";
        break;
    }

    cout << "comparison of " << s1 << " and " << s2
         << " using the mcolc facet : "
         << srslt << endl;
}


void test(const string& s1, const string& s2)
{
    /// since compare() operates on char[]s
    const char* s1b = s1.data();        /// start of data
    const char* s1e = s1b + s1.size();  /// end of data
    const char* s2b = s2.data();        /// start of data
    const char* s2e = s2b + s2.size();  /// end of data

    int rslt = mcolc.compare(s1b, s1e, s2b, s2e);

    /// display results
    print(s1, s2, rslt);
}


int main()
{
    test("Hello", "Hello");
    test("Hello", "hello");
    test("hello", "Hello");
}
