From: Jan Nieuwenhuizen Date: Tue, 14 Feb 2006 23:50:16 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: release/2.7.35~31 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=1e2c23a85f2dbb849f5c71696c1bd320816270cb;p=lilypond.git *** empty log message *** --- diff --git a/ChangeLog b/ChangeLog index 869058f0be..c46afb8051 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2006-02-15 Jan Nieuwenhuizen + + * flower/include/std-vector.hh: Better wrapper compatibility with + std::vector. + + * flower/include/flower-proto.hh: Remove cheap forward declaration + attempts. + + * stepmake/aclocal.m4 (STEPMAKE_STL_DATA_METHOD): Bugfix. + 2006-02-14 Graham Percival * Documentation/user/invoking.itely: add warning about command line. diff --git a/flower/include/flower-proto.hh b/flower/include/flower-proto.hh index 91e2e36aae..1e14a5b10c 100644 --- a/flower/include/flower-proto.hh +++ b/flower/include/flower-proto.hh @@ -1,4 +1,3 @@ - /* fflower-proto.hh -- typenames in flowerlib @@ -17,15 +16,8 @@ template struct Hash_table_iter; typedef unsigned char Byte; struct String_convert; -#if 0 -namespace std { -struct string; -template struct vector; -} -#else #include "std-string.hh" #include "std-vector.hh" -#endif using namespace std; #include "real.hh" diff --git a/flower/include/std-vector.hh b/flower/include/std-vector.hh index bb60308d5d..8c31e664aa 100644 --- a/flower/include/std-vector.hh +++ b/flower/include/std-vector.hh @@ -60,18 +60,18 @@ typedef size_t vsize; namespace std { /* Interface without pointer arithmetic (iterator) semantics. */ - template - class vector : public __vector + template > + class vector : public __vector { public: typedef typename __vector::iterator iterator; typedef typename __vector::const_iterator const_iterator; - vector () : __vector () + vector () : __vector () { } - vector (const_iterator b, const_iterator e) : __vector (b, e) + vector (const_iterator b, const_iterator e) : __vector (b, e) { } @@ -88,32 +88,6 @@ namespace std { } }; - /* FIXME: it appears that choosing this function is broken when stl - has no data () member too... */ - template - void - binary_search_bounds (vector const &table, - T const *key, int (*compare) (T *const &, T *const &), - vsize *lo, - vsize *hi) - { - vsize cmp; - int result; - - /* binary search */ - do - { - cmp = (*lo + *hi) / 2; - - result = (*compare) ((T *) key, table[cmp]); - - if (result < 0) - *hi = cmp; - else - *lo = cmp; - } - while (*hi - *lo > 1); - } } /* namespace std */ #endif /* !HAVE_STL_DATA_METHOD */ @@ -183,6 +157,31 @@ binary_search_bounds (vector const &table, while (*hi - *lo > 1); } +template +void +binary_search_bounds (vector const &table, + T const *key, int (*compare) (T *const &, T *const &), + vsize *lo, + vsize *hi) +{ + vsize cmp; + int result; + + /* binary search */ + do + { + cmp = (*lo + *hi) / 2; + + result = (*compare) ((T *) key, table[cmp]); + + if (result < 0) + *hi = cmp; + else + *lo = cmp; + } + while (*hi - *lo > 1); +} + #if 0 /* FIXME: what if COMPARE is named: int operator == (T const&, T const&), wouldn't that work for most uses of BINARY_SEARCH? diff --git a/flower/test-std.cc b/flower/test-std.cc index c2214418a5..4724f8f5ca 100644 --- a/flower/test-std.cc +++ b/flower/test-std.cc @@ -1,8 +1,9 @@ - +#define STD_VECTOR 1 #if !STD_VECTOR #define Array flower_vector #endif + #define HAVE_BOOST_LAMBDA 1 #include "std-vector.hh" diff --git a/stepmake/aclocal.m4 b/stepmake/aclocal.m4 index 8ec3c5954d..b51d087712 100644 --- a/stepmake/aclocal.m4 +++ b/stepmake/aclocal.m4 @@ -1046,7 +1046,7 @@ AC_DEFUN(STEPMAKE_STL_DATA_METHOD, [ #include using namespace std; vector v; -(void) v.data (); +void *p = v.data (); ]])], [stepmake_stl_data_method=yes], [stepmake_stl_data_method=no]))