Boost logo

Boost :

Subject: Re: [boost] Boost library submission (poll for interest)
From: strasser_at_[hidden]
Date: 2010-01-18 05:34:45

Zitat von "vicente.botet" <vicente.botet_at_[hidden]>:
>> what do you think about the basic_* and alias approach? is that feasible for
>> your library?
> Yes I think so.

great. Bob, what about your library?

> Does TransactionManager::begin_transaction makes a transaction or
> registers the stack allocated one?

the basic_transaction_manager implementation does neither(see below).

> unspecified TM::begin_transaction() ;
> what about
> void TM::begin_transaction(TM::transaction&) ;

I considered that, but this approach has some problems(transaction
must be DefaultConstructible, deferred "construction", ...) and the
current approach is as powerful.
note that using a return value does not mean that the transaction has
to be CopyConstructible, the only requirement is that


is a valid expression.

you can for example do the following and still comply with the concept:

class transaction_manager{
   struct construct_tag{};
   construct_tag begin_transaction(){ return construct_tag(); }
   class transaction : noncopyable{
     explicit transaction(construct_tag);

in case you asked this question because of dynamic allocation, there
is not a single allocation caused e.g. by the following code (if the
accessed object is already loaded from disk):

transaction tx;
pinned_loc<pers_type const> l;
std::cerr << l->value;

whatever you store in ResourceManager::transaction of your resource
manager resides on the user´s stack.

> I would like to see something in the line of
> namespace this_transaction {
> transaction* current();
> ...
> }
> or
> namespace current_transaction {
> ...
> }

what´s your point of this? that you´d like to have a simple syntax to
obtain the current transaction?

a namespace doesn´t provide the type of the transaction manager
configured by the user.

the syntax to obtain the global transaction currently is:


as in, obtain the active transaction manager, and then obtain the
active transaction from the manager.

the return value is of type (TxMgr::transaction &).

Boost list run by bdawes at, gregod at, cpdaniel at, john at