static std::pair<pointer, bool>
    allocation_command(Allocator &a, allocation_type command,
                       size_type, size_type preferred_size,
                       size_type &received_size, const pointer &)
 {
    std::pair<pointer, bool> ret(pointer(), false);
    if(!(command & allocate_new)){
       if(!(command & nothrow_allocation)){
          throw_logic_error("version 1 allocator without allocate_new flag");
       }
    }
    else{
       received_size = preferred_size;
       BOOST_TRY{
          ret.first = a.allocate(received_size);
       }
       BOOST_CATCH(...){
          if(!(command & nothrow_allocation)){
             BOOST_RETHROW
          }
       }
       BOOST_CATCH_END
    }
    return ret;
 }
Exemple #2
0
 static pointer allocation_command(Allocator &a, allocation_type command,
                                   size_type, size_type &prefer_in_recvd_out_size, pointer &reuse)
 {
     pointer ret = pointer();
     if(BOOST_UNLIKELY(!(command & allocate_new) && !(command & nothrow_allocation))) {
         throw_logic_error("version 1 allocator without allocate_new flag");
     }
     else {
         BOOST_TRY{
             ret = a.allocate(prefer_in_recvd_out_size);
         }
         BOOST_CATCH(...) {
             if(!(command & nothrow_allocation)) {
                 BOOST_RETHROW
             }
         }
         BOOST_CATCH_END
         reuse = pointer();
     }
     return ret;
 }