Boost logo

Boost :

From: Markus Schöpflin (markus.schoepflin_at_[hidden])
Date: 2007-10-10 10:29:23


Hello,

this header file contains the following code:

   void* apply (void* address, std::size_t n) const
   {
     for(char* next = address = this->apply(address); !! --n;)
       this->apply(next = next+sizeof(T));
     return address;
   }

Tru64/CXX rightly voices objections when compiling this code, used for
example by optional_test_inplace:

cxx: Error: ../../../boost/utility/typed_in_place_factory.hpp, line 57: a
           value of type "void *" cannot be used to initialize an entity of
           type "char *" (D:badinittyp)
     for(char* next = address = this->apply(address); !! --n;)
---------------------^

Attached patch contains a fix for this. OK to commit?

Regards,
Markus

Index: typed_in_place_factory.hpp
===================================================================
--- typed_in_place_factory.hpp (revision 39872)
+++ typed_in_place_factory.hpp (working copy)
@@ -54,8 +54,8 @@
 
   void* apply (void* address, std::size_t n) const
   {
- for(char* next = address = this->apply(address); !! --n;)
- this->apply(next = next+sizeof(T));
+ for(void* next = address = this->apply(address); !! --n;)
+ this->apply(next = static_cast<char *>(next) + sizeof(T));
     return address;
   }
 


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk