Language: C++

#ifndef MYLIBRARY_DIJKSTRA_HPP
#define MYLIBRARY_DIJKSTRA_HPP 1

#include <utility>
#include <queue>
#include <vector>

struct dijk_graph {
  using Cap = long long int;
  public:
    dijk_graph() : _n(0) {}
    dijk_graph(int n) : _n(n), g(n), dist(n), prev(n) {}

    void add_edge(int from, int to, Cap cap){
      assert(0 <= from && from < _n);
      assert(0 <= to && to < _n);
      assert(0 <= cap);
      g[from].push_back(_edge{to, cap});
    }

    void make_table(int start){
      assert(0 <= start && start < _n);

      std::fill(dist.begin(), dist.end(), _inf);

      prev[0] = -1;
      Q.push(q_data(0, start));
      while (Q.size() != 0){
        auto p = Q.top();
        Q.pop();
        ll ud = p.first;
        ll u = p.second;
        if (dist[u] < ud){
          continue;
        }
        dist[u] = ud;

        for (auto t : g[u]){
          ll v = t.to;
          ll vd = ud + t.cap;
          if (dist[v] > vd){
            dist[v] = vd;
            Q.push(q_data(vd, v));
            prev[v] = u;
          }
        }
      }
    }

    Cap get_dist(int u){
      return dist[u];
    }

    int get_prev(int u){
      return prev[u];
    }

  private:
    int _n;
    struct _edge {
        int to;
        Cap cap;
    };
    std::vector<std::vector<_edge>> g;
    std::vector<long long int> dist;
    std::vector<int> prev;
    using q_data = std::pair<Cap, int>;
    Cap _inf = 1000000000000000000;
    std::priority_queue<q_data, std::vector<q_data>, std::greater<q_data>> Q;
};

#endif  // MYLIBRARY_DIJKSTRA_HPP


Compiler output:
a.cc: In member function 'void dijk_graph::add_edge(int, int, Cap)':
a.cc:15:7: error: 'assert' was not declared in this scope
   15 |       assert(0 <= from && from < _n);
      |       ^~~~~~
a.cc:6:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    5 | #include <queue>
  +++ |+#include <cassert>
    6 | #include <vector>
a.cc: In member function 'void dijk_graph::make_table(int)':
a.cc:22:7: error: 'assert' was not declared in this scope
   22 |       assert(0 <= start && start < _n);
      |       ^~~~~~
a.cc:22:7: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
a.cc:31:9: error: 'll' was not declared in this scope
   31 |         ll ud = p.first;
      |         ^~
a.cc:32:12: error: expected ';' before 'u'
   32 |         ll u = p.second;
      |            ^
a.cc:33:18: error: 'u' was not declared in this scope
   33 |         if (dist[u] < ud){
      |                  ^
a.cc:33:23: error: 'ud' was not declared in this scope
   33 |         if (dist[u] < ud){
      |                       ^~
a.cc:36:14: error: 'u' was not declared in this scope
   36 |         dist[u] = ud;
      |              ^
a.cc:36:19: error: 'ud' was not declared in this scope
   36 |         dist[u] = ud;
      |                   ^~
a.cc:39:14: error: expected ';' before 'v'
   39 |           ll v = t.to;
      |              ^
a.cc:40:14: error: expected ';' before 'vd'
   40 |           ll vd = ud + t.cap;
      |              ^~
a.cc:41:20: error: 'v' was not declared in this scope
   41 |           if (dist[v] > vd){
      |                    ^
a.cc:41:25: error: 'vd' was not declared in this scope; did you mean 'void'?
   41 |           if (dist[v] > vd){
      |                         ^~
      |                         void