std::find_if で該当する要素を指すイテレータを取得し、
std::distance で先頭要素との距離を取ってやれば良いかと思います。
C++
1#include <algorithm>
2#include <iostream>
3#include <iterator>
4#include <vector>
5
6namespace {
7 template <typename T>
8 using matrix = std::vector<std::vector<T>>;
9}
10
11int main(void) {
12 matrix<int> data{
13 {4, 6, 5}, {4, 4, 5}, {1, 2, 3}
14 };
15
16 auto it = std::find_if(
17 std::begin(data), std::end(data),
18 [](const auto& row) {
19 return row.at(0) == 4 && row.at(1) == 6;
20 }
21 );
22 if(it == std::end(data)) {
23 std::cout << "not found";
24 }
25 else {
26 std::cout << std::distance(std::begin(data), it);
27 }
28
29 return 0;
30}
実行結果 Wandbox
C++をあまり触り慣れていないので、穴はあるかもしれませんが。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。