Q: What can be used to replace loops and if statements in my code? I implemented battle ship game. Here i have function which checks game field correctness.
bool Model::checkMyField() const
{
    // Check field for correct ship placement
    return (
        shipNum(1) == 4 &&
        shipNum(2) == 3 &&
        shipNum(3) == 2 &&
        shipNum(4) == 1
    );
}

int Model::shipNum( int size ) const
{
    int shipNumber = 0;

    for( int i = 0; i < 10; i++ )
        for( int j = 0; j < 10; j++ )
            if( isShip(size, i, j) )
                shipNumber++;

    return shipNumber;
}

bool Model::isShip( int size, int x, int y ) const
{
    // left field !clear
    if( x > 0 && myField->getCell(x - 1, y) != CL_CLEAR )
        return false;

    // up field !clear
    if( y > 0 && myField->getCell(x, y - 1) != CL_CLEAR )
        return false;

    // no ship here
    if( myField->getCell(x, y) == CL_CLEAR )
        return false;

    int tmp = x;
    int num = 0;

    // checking in right direction
    while( myField->getCell(tmp, y) != CL_CLEAR && tmp < 10 )
    {
        tmp++;
        num++;
    }

    if( num == size )
    {
        if( myField->getCell(x, y + 1) != CL_CLEAR )
            return false;

        return true;
    }

    tmp = y;
    num = 0;

    // checking in down direction
    while( myField->getCell(x, tmp) != CL_CLEAR && tmp < 10 )
    {
        tmp++;
        num++;
    }

    if( num == size )
    {
        if( myField->getCell(x + 1, y) != CL_CLEAR )
            return false;

        return true;
    }

    return false;
}

It works but i want to avoid so many loops and ifs. 
for( int i = 0; i < 10; i++ )
            for( int j = 0; j < 10; j++ )

Wanted to replace it with std::for_each() and for example these similar ifs  
if( x > 0 && myField->getCell(x - 1, y) != CL_CLEAR )
            return false;

with little lambda but i do not know how to do it. Can you explain how to do it and give an example of 1 lambda for me to understand it and create own lambdas for other ifs? Or suggest what else I can use.

A: To avoid the double loop
for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++)

You need some position iterator.
struct Pos
{
    int x = -1;
    int y = -1;
}

Simpler here would be to reuse existing container, such as std::array or std::vector
constexpr std::size boardSize = 10;
constexpr std::array<Pos, boardSize * boardSize> compute_positions()
{
    std::array<Pos, boardSize * boardSize> res{};

    std::size_t i = 0;
    for (std::size_t x = 0; x != boardSize; ++x) {
        for (std::size_t y = 0; y != boardSize; ++y) {
            res[i++] = {x, y};
        }
    }
    return res;
}
constexpr std::array<Pos, boardSize * boardSize> positions = compute_positions();

then
int Model::shipNum( int size ) const
{
    return std::count_if(positions.begin(),
                         positions.end(),
                         [&](auto& pos){ return isShip(size, pos.x, pos.y); });
}

Not really useful if it is the only place you have the double loop though ;)
For the if part:
if (x > 0 && myField->getCell(x - 1, y) != CL_CLEAR)
    return false;

cannot be removed, but bound check can be removed by surrounding the board of special cells.
So instead of a board 10x10, you might use a 12x12 board. extra cell having appropriate value (CL_CLEAR seems good for shown code, but new value might be better)
indexes has to be adjusted, instead of [0-9], possible values are now [1-10].
but applying +1 or -1 would still be valid.
if (myField->getCell(x, y + 1) != CL_CLEAR) // you forgot bound checking
    return false;
return true;

can be simplified by
return myField->getCell(x, y + 1) == CL_CLEAR;

