text
stringlengths 0
2.2M
|
---|
#include <numeric> // for 'iota'
|
#include <sstream>
|
static bool unaryPredicate(int)
|
// Return 'true' irrespective of the (ignored) input argument. Used to
|
// instantiate function templates in the 'useCpp11Algorithms' test
|
// function.
|
{
|
return true;
|
}
|
static void useCpp11Algorithms()
|
// Use each of the function templates associated with the
|
// 'BSLS_LIBRARYFEATURES_HAS_CPP11_BASELINE_LIBRARY' flag in a
|
// syntactically correct (and semantically meaningless) manner as a
|
// compile-time test that these templates are available.
|
{
|
const int iarray[] = { 0, 1, 2 };
|
const size_t NUM_ELEMENTS = sizeof iarray / sizeof *iarray;
|
const int *inputFirst = &iarray[0];
|
const int *inputLast = &iarray[NUM_ELEMENTS];
|
(void)native_std::all_of(inputFirst, inputLast, unaryPredicate);
|
(void)native_std::any_of(inputFirst, inputLast, unaryPredicate);
|
int oarray[NUM_ELEMENTS];
|
int *outputFirst = &oarray[0];
|
int *outputLast = &oarray[NUM_ELEMENTS];
|
native_std::copy_if(inputFirst,
|
inputLast,
|
outputFirst,
|
unaryPredicate);
|
native_std::copy_n (inputFirst, NUM_ELEMENTS, outputFirst);
|
(void)native_std::find_if_not(inputFirst, inputLast, unaryPredicate);
|
native_std::iota(outputFirst, outputLast, 0);
|
(void)native_std::is_heap (inputFirst, inputLast);
|
(void)native_std::is_heap_until(inputFirst, inputLast);
|
(void)native_std::is_partitioned (inputFirst,
|
inputLast,
|
unaryPredicate);
|
(void)native_std::is_permutation (inputFirst, inputLast, inputFirst);
|
(void)native_std::is_sorted (inputFirst, inputLast);
|
(void)native_std::is_sorted_until(inputFirst, inputLast);
|
(void)native_std::minmax(0, 1);
|
(void)native_std::minmax_element(inputFirst, inputLast);
|
int oarray2[NUM_ELEMENTS];
|
int *output2First = &oarray2[0];
|
int *output2Last = &oarray2[NUM_ELEMENTS];
|
native_std::move (outputFirst, outputLast, output2First);
|
native_std::move_backward(outputFirst, outputLast, output2Last);
|
(void)native_std::none_of(inputFirst, inputLast, unaryPredicate);
|
native_std::partition_copy(inputFirst,
|
inputLast,
|
outputFirst,
|
output2First,
|
unaryPredicate);
|
(void)native_std::partition_point(inputFirst,
|
inputLast,
|
unaryPredicate);
|
SimpleUniformRandomNumberGenerator surng;
|
native_std::shuffle(outputFirst,
|
outputLast,
|
surng);
|
native_std::uninitialized_copy_n(inputFirst,
|
NUM_ELEMENTS,
|
outputFirst);
|
// test <ios> C++11 functions
|
const native_std::error_category& errorCategory =
|
native_std::iostream_category();
|
(void) errorCategory;
|
(void)native_std::make_error_code(native_std::io_errc::stream);
|
(void)native_std::make_error_condition(native_std::io_errc::stream);
|
ASSERT(true ==
|
native_std::is_error_code_enum<native_std::io_errc>::value);
|
double f;
|
native_std::istringstream("0x1P-1022") >> native_std::hexfloat >> f;
|
native_std::istringstream("0.01") >> native_std::defaultfloat >> f;
|
}
|
static void useTypeIndex() {
|
const native_std::type_info &info = typeid(int);
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.