Использование алгоритмов из Стандартной библиотеки на не строках C-style

Можно ли использовать алгоритмы из стандартной библиотеки С++, которые используются, как я понимаю, только на строках C-style, на обычных строках, типа как на массиве, как у меня в коде?

#include <array>
#include <iostream>
#include <string_view>
#include <algorithm>

bool condition(float** arr, int n, float x);

int main()
{
    int n = 0;
    int m = 0;
    std::cin >> n;
    std::cin >> m;
    float** arr = new float* [n];
    for (int i = 0; i < n; i++)
        arr[i] = new float[m];
    std::cout << "Enter a number to find: " << std::endl;
    float x = 0;
    std::cin >> x;
    auto found(std::find(arr.begin(), arr.end(), condition));
    if (found == arr.end())
        std::cout << "No " << x << std::endl;
    else
        std::cout << "Found " << *found << std::endl;
    return 0;
}

bool condition(float** arr, int n, float x)
{
    return (arr.find(x) != std::arr::npos);
}

P.s. Простите за кривой код, просто изучаю эти темы самостоятельно, спросить не у кого...


Ответы (0 шт):