boost::spreadsort for std::pair
You spend a lot of lines of code trying to get the expressions lessthan(), getsize(), and bracket() to behave like plain old functions. Consider just using plain old functions, instead. For example:

static uint8_t get_char(int x, size_t offset)
{
    const int bit_shift = 8 * (sizeof(int) - offset - 1);
    uint8_t result = (x &gt;&gt; bit_shift) &amp; 0xFF;
    if (offset == 0) result ^= 128;
    return result;
}

static uint8_t bracket(const std::pair&lt;int,int&gt;&amp; x, size_t offset)
{
    if (offset &lt; sizeof(int))
      return get_char(x.first, offset);
    return get_char(x.second, offset - sizeof(int));
}

...
string_sort(a.begin(), a.end(), bracket, getsize(), lessthan());


You could also productively replace the expression getsize() with

auto getsize = [](auto){ return 2*sizeof(int); };

...
string_sort(a.begin(), a.end(), bracket, getsize, lessthan());


Finally, lessthan is equivalent to std::less&lt;std::pair&lt;int,int&gt;&gt;, so you can just write

string_sort(a.begin(), a.end(), bracket, getsize, std::less&lt;&gt;());


That's the kind of shortening you were looking for, right? :)