1 // PR tree-optimize/42337
3 // { dg-options "-O2" }
5 template<class _T1, class _T2> struct pair {
9 inline const _Tp& max(const _Tp& __a, const _Tp& __b) { }
11 template<typename _ForwardIterator, typename _Tp, typename _Compare> _ForwardIterator
12 lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val, _Compare __comp) { }
13 template<class _CharT> struct char_traits {};
15 template<typename _Iterator, typename _Container> class __normal_iterator {
16 public: typedef _Iterator iterator_type;
17 __normal_iterator& operator++() {
20 template<typename _IteratorL, typename _IteratorR, typename _Container>
21 inline bool operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { }
22 template<typename _Tp> class new_allocator {
25 typedef const _Tp* const_pointer;
28 template<typename _Tp>
29 class allocator: public new_allocator<_Tp> {
31 template<typename _Tp1> struct rebind {
32 typedef allocator<_Tp1> other;
36 template<typename _Arg, typename _Result> struct unary_function { };
37 template<typename _Arg1, typename _Arg2, typename _Result> struct binary_function { };
38 template<typename _Tp> struct less : public binary_function<_Tp, _Tp, bool> { };
39 template<typename _Pair> struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> { };
40 template<typename _Tp> struct _Rb_tree_iterator {
42 pointer operator->() const {
45 template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc = allocator<_Val> >
47 typedef _Val value_type;
48 public: typedef _Rb_tree_iterator<value_type> iterator;
50 template <typename _Key, typename _Tp, typename _Compare = less<_Key>, typename _Alloc = allocator<pair<const _Key, _Tp> > >
52 public: typedef _Key key_type;
53 typedef pair<const _Key, _Tp> value_type;
54 typedef _Compare key_compare;
55 private: typedef typename _Alloc::template rebind<value_type>::other _Pair_alloc_type;
56 typedef _Rb_tree<key_type, value_type, _Select1st<value_type>, key_compare, _Pair_alloc_type> _Rep_type;
57 public: typedef typename _Pair_alloc_type::pointer pointer;
58 typedef typename _Rep_type::iterator iterator;
59 iterator find(const key_type& __x) { }
62 template<typename _Tp, typename _Alloc> struct _Vector_base {
63 typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
65 template<typename _Tp, typename _Alloc = allocator<_Tp> >
66 class vector : protected _Vector_base<_Tp, _Alloc> {
67 typedef _Vector_base<_Tp, _Alloc> _Base;
68 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
70 typedef typename _Tp_alloc_type::pointer pointer;
71 typedef typename _Tp_alloc_type::const_pointer const_pointer;
72 typedef __normal_iterator<pointer, vector> iterator;
73 typedef __normal_iterator<const_pointer, vector> const_iterator;
75 const_iterator begin() const { }
76 const_iterator end() const { }
77 unsigned long size() const { }
89 const vector<int> &its_;
96 template <typename T> class vector32 {
100 typedef const T* const_iterator;
101 iterator begin() { return data_; }
102 iterator end() { return data_ + size_; }
103 long unsigned int size() const { return size_; }
108 struct SF : public pair<unsigned long long, double> { };
110 template<typename KEY, typename VALUE> class SFVT {
111 private: typedef vector32<SF> Container;
112 typedef typename Container::const_iterator CI;
113 mutable Container v_;
114 mutable bool sorted_;
115 struct Cmp : public binary_function<SF, SF, bool> {
117 __attribute__((always_inline)) VALUE IS(const SFVT &sfv) const {
118 if (sfv.v_.size() < v_.size()) {
119 return sfv.IS(*this);
123 CI beg = sfv.v_.begin();
124 CI end = sfv.v_.end();
125 for (CI i = v_.begin();
127 ++i) { beg = lower_bound(beg, end, *i, Cmp()); if (beg == end) { return sum; } }
130 public: explicit SFVT(const int capacity = 0) : sorted_(true) { }
131 long unsigned int size() const { }
132 __attribute__((always_inline)) VALUE DP(const SFVT &sfv) const {
136 class SFV : public SFVT<unsigned long long, double> { };
142 int nbests_requested = max(p->max_s_, flag);
143 map<int, int>::iterator it = cs_.find(p->cl_);
144 int* c = &it->second;
145 for (vector<int>::const_iterator iter = p->its_.begin();
146 iter != p->its_.end();
156 for (vector<int*>::iterator iter = fb.begin();
157 (iter != fb.end() && nr < nbests_requested);
167 for (int i = 0, j = 0;
168 i < uw.size() && j < s_weights.size();
171 const double tc = uw.DP(s_weights);