Esempio n. 1
0
File: main.cpp Progetto: CCJY/coliru
void uniform_random(TContainer& container, 
const typename TContainer::value_type min, 
const typename TContainer::value_type max) {
    using uniform_distribution = typename uniform_distribution_helper<typename TContainer::value_type>::type;
    std::cout << typeid(uniform_distribution).name() << '\n';
    std::random_device rd;
    std::mt19937 gen(rd());

    // Below line does not work with integers container
    uniform_distribution distribution(min, max);

    auto lambda_norm_dist = [&](){ return distribution(gen); };
    std::generate(container.begin(), container.end(), lambda_norm_dist);
}
Esempio n. 2
0
typename TContainer::value_type JoinStrings(TContainer const & container,
                                            TDelimiter const & delimiter)
{
  return JoinStrings(container.begin(), container.end(), delimiter);
}
Esempio n. 3
0
	void fill(TContainer& container) {
		rrange_insert<TContainer, typename TContainer::iterator> insert_range(container, container.begin());
		while (range_.ok() && range_.take2(insert_range));
	}
Esempio n. 4
0
	void sort(TContainer & source, const TCmp & cmp)
	{
		std::sort(source.begin(), source.end(), cmp);
	}