@@ -1298,7 +1298,7 @@ namespace opal {
1298
1298
#endif
1299
1299
train1 (pool);
1300
1300
std::fprintf (stderr, " \r %s%s iter=%-3u #ex=%-8ld " ,
1301
- _opt.average ? " Avg " : " " , algo[_opt.algo ], i, _nex);
1301
+ _opt.average ? " Avg " : " " , algo[_opt.algo ], i, long ( _nex) );
1302
1302
if (_opt.kernel == POLY) std::fprintf (stderr, " #SV=%u; " , _nsv);
1303
1303
if (std::strcmp (tfn, " " ) != 0 ) {
1304
1304
Model m (_opt);
@@ -1702,6 +1702,7 @@ namespace opal {
1702
1702
typedef ss_t ::const_iterator ss_it;
1703
1703
typedef std::vector <ss_t > f2ss_t ;
1704
1704
#if defined (USE_HASH) || defined (USE_TR1_HASH)
1705
+ #if 0 // std::unary_function and std::binary_function is deprecated in C++11 and removed in C++17
1705
1706
struct hash_sv : std::unary_function <const sv_t*, size_t> {
1706
1707
result_type operator () (argument_type f) const
1707
1708
{ return std::accumulate (f->begin (), f->end (), FNV_BASIS, inc_fnv ()); }
@@ -1712,12 +1713,26 @@ namespace opal {
1712
1713
std::equal (a->begin (), a->end (), b->begin ());
1713
1714
}
1714
1715
};
1716
+ #else
1717
+ struct hash_sv {
1718
+ inline size_t operator ()(const sv_t *) const {
1719
+ return std::accumulate (f->begin (), f->end (), FNV_BASIS, inc_fnv ()); }
1720
+ }
1721
+ };
1722
+ struct eq_sv {
1723
+ bool operator () (const sv_t *a, const sv_t *b) const {
1724
+ return a->getSize () == b->getSize () &&
1725
+ std::equal (a->begin (), a->end (), b->begin ());
1726
+ }
1727
+ };
1728
+ #endif
1715
1729
#ifdef USE_HASH
1716
1730
typedef std::unordered_map <const sv_t *, uint, hash_sv, eq_sv> fv2s_t ;
1717
1731
#else
1718
1732
typedef std::tr1::unordered_map <const sv_t *, uint, hash_sv, eq_sv> fv2s_t ;
1719
1733
#endif
1720
1734
#else
1735
+ #if 0
1721
1736
struct less_sv : std::binary_function <const sv_t*, const sv_t*, bool> {
1722
1737
result_type operator () (first_argument_type a, second_argument_type b) const {
1723
1738
for (const uint* p (a->begin ()), *q (b->begin ());; ++p, ++q) {
@@ -1728,6 +1743,18 @@ namespace opal {
1728
1743
}
1729
1744
}
1730
1745
};
1746
+ #else
1747
+ struct less_sv {
1748
+ bool operator () (const sv_t * a, const sv_t * b) const {
1749
+ for (const uint* p (a->begin ()), *q (b->begin ());; ++p, ++q) {
1750
+ if (p == a->end ()) return q != b->end ();
1751
+ if (q == b->end ()) return false ;
1752
+ else if (*p < *q) return true ;
1753
+ else if (*p > *q) return false ;
1754
+ }
1755
+ }
1756
+ };
1757
+ #endif
1731
1758
typedef std::map <const sv_t *, uint, less_sv> fv2s_t ;
1732
1759
#endif
1733
1760
// variables
@@ -2195,7 +2222,7 @@ namespace opal {
2195
2222
if (rss > _opt.trieT ) {
2196
2223
std::fprintf (stderr,
2197
2224
" shrink splitN: 2^%lu-1 (= %u) => 2^%u-1 (= %u)\n " ,
2198
- _nbin, _opt.splitN , i, (1 << i) - 1 );
2225
+ static_cast < unsigned long >( _nbin) , _opt.splitN , i, (1 << i) - 1 );
2199
2226
while (_nbin > i) {
2200
2227
--_nbin;
2201
2228
delete _ftrie[_nbin];
0 commit comments