Reputation: 12138
Could someone please give a complete (including all header files) working (that compiles) example of how to use Boost BCCL on a for example a boost::RandomAccessContainer
together with std::sort?
Upvotes: 0
Views: 344
Reputation: 545598
What’s wrong with the example given in the documentation?
Granted, it’s not complete but it should be trivial to get it to compile …
Furthermore, Your request cannot be fulfilled: you want concept checking for std::sort
, but this function cannot be re-defined. You could of course define your own sorting function, and use the BCCL code provided by the documentation:
#include <algorithm>
#include "boost/concept/requires.hpp"
template<typename I>
BOOST_CONCEPT_REQUIRES(
((Mutable_RandomAccessIterator<I>))
((LessThanComparable<typename Mutable_RandomAccessIterator<I>::value_type>)),
(void)) // return type
sort(I begin, I end)
{
std::sort(begin, end);
}
int main() {
int a[] = { 1, 4, 3, 2, 6, 5 };
sort(a, a + 6);
}
Note: I have never used the BCCL. Hacking the above together was trivial and took me less than five minutes. Certainly you could have done the same?
Upvotes: 3