virtual ~request_handlers() { std::for_each( boost::make_transform_iterator(request_handlers_.begin(), get_spec()), boost::make_transform_iterator(request_handlers_.end(), get_spec()), std::default_delete<request_spec>()); std::for_each( boost::make_transform_iterator(request_handlers_.begin(), get_handler()), boost::make_transform_iterator(request_handlers_.end(), get_handler()), std::default_delete<request_handler>()); }
void create_frequencies( double g ) { boost::mt19937 rng; boost::cauchy_distribution<> cauchy( 0.0 , g ); boost::variate_generator< boost::mt19937&, boost::cauchy_distribution<> > gen( rng , cauchy ); generate( m_omega.begin() , m_omega.end() , gen ); }
inline std::string to_string( const container_type<F>& container, const char* delimeter = "; ") { std::stringstream ss; for(auto it = container.begin(); std::next(it)!=container.end(); ++it) ss << *it << delimeter; ss << container.back(); return ss.str(); }
static inline void build_half_hull(container_type const& input, container_type& output, point_type const& left, point_type const& right) { output.push_back(left); for(iterator it = input.begin(); it != input.end(); ++it) { add_to_hull<Factor>(*it, output); } add_to_hull<Factor>(right, output); }
request_handler *find(std::string const &request) { auto end(boost::make_transform_iterator(request_handlers_.end(), get_spec())); auto found_spec( std::find_if( boost::make_transform_iterator(request_handlers_.begin(), get_spec()), end, spec_conformed(request))); if (found_spec == end) return 0; auto found_pair(found_spec.base()); return found_pair->second; }
std::vector<std::string> create_paths( const std::string& directory, const container_type<std::string>& file_names, const std::string& suffix=".txt" ) { std::vector<std::string> ret; for( auto it=file_names.begin(); it!=file_names.end(); ++it) { std::stringstream ss; ss << directory << "/" << *it << suffix; bfs::path p( ss.str()); p = bfs::absolute(p); p.make_preferred(); ret.push_back( p.string()); } return ret; }
void handler_clear_backup(container_type& cont) const { typedef typename container_type::iterator iter_type; for(iter_type i = cont.begin(), isize = cont.end(); i != isize; ++i) { if(i->second) { i->second->close(); } } cont.clear(); }
AsynchronousBufferReaderList( in_iterator_type ina, in_iterator_type ine, uint64_t rnumbuffers = 16, uint64_t rbufsize = 32, uint64_t offset = 0) : C(ina,ine), ita(C.begin()), ite(C.end()), numbuffers(rnumbuffers), bufsize(rbufsize) { while ( ita != ite && offset >= getFileSize(*ita) ) { offset -= getFileSize(*ita); ita++; } if ( ita != ite ) { reader = UNIQUE_PTR_MOVE(reader_ptr_type(new AsynchronousBufferReader(*ita, numbuffers,bufsize,offset))); } }
static const_iterator begin(const container_type& p) { return p.begin(); }
bool hit_test(value_type x,value_type y, double) const { return point_inside_path(x,y,cont_.begin(),cont_.end()); }
static typename result_of::const_handle_type<container_type, iterator_handle_tag>::type handle( container_type const & container, value_type const & value ) { for (typename container_type::const_iterator it = container.begin(); it != container.end(); ++it) if ( &(*it) == &value ) return it; return container.end(); }
iterator begin() const { return cont_.begin(); }
iterator begin() { return container_.begin(); }
iterator begin() { return values.begin(); }
iterator insert(iterator pos, Iter first, Iter last) { //TODO: when GCC has fixed insert just directly return it's value auto dist=std::distance(begin(), pos); values.insert(pos, first, last); return values.begin() + dist; }
const_iterator begin() const { return list.begin(); }
// // Iterators // iterator begin() { return list.begin(); }
bool hit_test(value_type x,value_type y, double tol) const { return point_on_path(x,y,cont_.begin(),cont_.end(),tol); }
const_iterator begin() const { return container_.begin(); }
static void sort(container_type<size_t> &front, comparator_type comp) { std::sort(front.begin(), front.end(), comp); }
void operator() (container_type & src_container, viennagrid::view<base_container_type, handle_container_tag> & dst_view) { for (typename container_type::iterator it = src_container.begin(); it != src_container.end(); ++it) if (pred_( *it )) dst_view.insert_handle( it.handle() ); }
BigUInt(const container_type& array) : data(array.begin(), array.end()) { }