开发者

Making an array available outside of a function

开发者 https://www.devze.com 2023-04-08 09:35 出处:网络
I have the following code: class Transaction : public transactor<> { public: Transaction(arg1, arg2) // can put any number of args

I have the following code:

class Transaction : public transactor<>
{
    public:
    Transaction(arg1, arg2) // can put any number of args
    :transactor<>(arg1)
    {
        //some initialization
    }

    void operator()(argument_type &T)
    {
        //create an array
        //cannot modify outside program from here
    }

    void on_commit()
    {
        //must make array created in operator()() available to outside program here
        //cannot return anything
    }

Both operator()() and on_commit() are called by 3rd party code.

In the operator()() method, I create an array after querying a database. In case the transaction fails, the outside program cannot be changed at this point. This must all be done in the on_commit() method.

The question is: How can I make this array available to th开发者_开发技巧e outside program?

I am quite new to C++ and I understand this is likely a rather simple question.

0

精彩评论

暂无评论...
验证码 换一张
取 消