0

Possible Duplicate:
Why vector<bool>::reference doesn’t return reference to bool?

I have a mock class which I am using in my unit tests.

I looks something like:

class Mock
{
public:
    ...

    static ReturnType isKeyFunction(bool* _isKey)
    {
        _isKey = &(*isKeyI++);
        ...
    }
    ...
    static std::vector<bool> isKey;
    static std::vector<bool>::iterator isKeyI;
};

So the vector is filled with values and the iterator is incremented each time a value is used by the test.

The problem is that the code wont compile and I'm guessing its because std::vector is saved as bits and I can point to a member in it with a bool*.

error C2440: '=' : cannot convert from 'std::_Vb_reference<_Alloc> *' to 'bool *'

How might I solve this?

4

0 に答える 0