using std::accumulate when there is pointer

  accumulate, c++, lambda, smart-pointers, vector

Is this the only solution when there is a pointer that points to a vector and we would like to use accumulate to sum up numbers?
Is there any simpler solution rather than writing a lambda function and using a four argument type of accumulating?

Also, for using std::sort, will the situation be the same?

Here is the code:

#include <random>
#include <vector>
#include <iostream>
using namespace std;

int main() {
    const int N=3; 

    auto  p=make_unique<array<int,N>> ();

    return 0;

Source: Windows Questions C++