1 // PR tree-optimize/42337
3 // { dg-options "-O2" }
4 // { dg-additional-options "-Wno-return-type" }
6 template<class _T1, class _T2> struct pair {
10 inline const _Tp& max(const _Tp& __a, const _Tp& __b) { }
12 template<typename _ForwardIterator, typename _Tp, typename _Compare> _ForwardIterator
13 lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __val, _Compare __comp) { }
14 template<class _CharT> struct char_traits {};
16 template<typename _Iterator, typename _Container> class __normal_iterator {
17 public: typedef _Iterator iterator_type;
18 __normal_iterator& operator++() {
21 template<typename _IteratorL, typename _IteratorR, typename _Container>
22 inline bool operator!=(const __normal_iterator<_IteratorL, _Container>& __lhs, const __normal_iterator<_IteratorR, _Container>& __rhs) { }
23 template<typename _Tp> class new_allocator {
26 typedef const _Tp* const_pointer;
29 template<typename _Tp>
30 class allocator: public new_allocator<_Tp> {
32 template<typename _Tp1> struct rebind {
33 typedef allocator<_Tp1> other;
37 template<typename _Arg, typename _Result> struct unary_function { };
38 template<typename _Arg1, typename _Arg2, typename _Result> struct binary_function { };
39 template<typename _Tp> struct less : public binary_function<_Tp, _Tp, bool> { };
40 template<typename _Pair> struct _Select1st : public unary_function<_Pair, typename _Pair::first_type> { };
41 template<typename _Tp> struct _Rb_tree_iterator {
43 pointer operator->() const {
46 template<typename _Key, typename _Val, typename _KeyOfValue, typename _Compare, typename _Alloc = allocator<_Val> >
48 typedef _Val value_type;
49 public: typedef _Rb_tree_iterator<value_type> iterator;
51 template <typename _Key, typename _Tp, typename _Compare = less<_Key>, typename _Alloc = allocator<pair<const _Key, _Tp> > >
53 public: typedef _Key key_type;
54 typedef pair<const _Key, _Tp> value_type;
55 typedef _Compare key_compare;
56 private: typedef typename _Alloc::template rebind<value_type>::other _Pair_alloc_type;
57 typedef _Rb_tree<key_type, value_type, _Select1st<value_type>, key_compare, _Pair_alloc_type> _Rep_type;
58 public: typedef typename _Pair_alloc_type::pointer pointer;
59 typedef typename _Rep_type::iterator iterator;
60 iterator find(const key_type& __x) { }
63 template<typename _Tp, typename _Alloc> struct _Vector_base {
64 typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type;
66 template<typename _Tp, typename _Alloc = allocator<_Tp> >
67 class vector : protected _Vector_base<_Tp, _Alloc> {
68 typedef _Vector_base<_Tp, _Alloc> _Base;
69 typedef typename _Base::_Tp_alloc_type _Tp_alloc_type;
71 typedef typename _Tp_alloc_type::pointer pointer;
72 typedef typename _Tp_alloc_type::const_pointer const_pointer;
73 typedef __normal_iterator<pointer, vector> iterator;
74 typedef __normal_iterator<const_pointer, vector> const_iterator;
76 const_iterator begin() const { }
77 const_iterator end() const { }
78 unsigned long size() const { }
90 const vector<int> &its_;
97 template <typename T> class vector32 {
101 typedef const T* const_iterator;
102 iterator begin() { return data_; }
103 iterator end() { return data_ + size_; }
104 long unsigned int size() const { return size_; }
109 struct SF : public pair<unsigned long long, double> { };
111 template<typename KEY, typename VALUE> class SFVT {
112 private: typedef vector32<SF> Container;
113 typedef typename Container::const_iterator CI;
114 mutable Container v_;
115 mutable bool sorted_;
116 struct Cmp : public binary_function<SF, SF, bool> {
118 __attribute__((always_inline)) VALUE IS(const SFVT &sfv) const {
119 if (sfv.v_.size() < v_.size()) {
120 return sfv.IS(*this);
124 CI beg = sfv.v_.begin();
125 CI end = sfv.v_.end();
126 for (CI i = v_.begin();
128 ++i) { beg = lower_bound(beg, end, *i, Cmp()); if (beg == end) { return sum; } }
131 public: explicit SFVT(const int capacity = 0) : sorted_(true) { }
132 long unsigned int size() const { }
133 __attribute__((always_inline)) VALUE DP(const SFVT &sfv) const {
137 class SFV : public SFVT<unsigned long long, double> { };
143 int nbests_requested = max(p->max_s_, flag);
144 map<int, int>::iterator it = cs_.find(p->cl_);
145 int* c = &it->second;
146 for (vector<int>::const_iterator iter = p->its_.begin();
147 iter != p->its_.end();
157 for (vector<int*>::iterator iter = fb.begin();
158 (iter != fb.end() && nr < nbests_requested);
168 for (int i = 0, j = 0;
169 i < uw.size() && j < s_weights.size();
172 const double tc = uw.DP(s_weights);