मैं वर्तमान में बूस्ट डिजस्ट्रा - http://www.boost.org/doc/libs/1_52_0/libs/graph/doc/dijkstra_shortest_paths.html के दस्तावेज़ीकरण को देख रहा हूं; मेरा उद्देश्य मेरी दूरी की गणना करते समय "प्लस" के बजाय "अधिकतम" प्राप्त करने के लिए दूरी संयोजन को संशोधित करना है। डॉक्टर यह कहता है:मैं बूस्ट डिजस्ट्रा में एक कस्टम दूरी कैसे परिभाषित करूं?
IN: distance_combine(CombineFunction cmb)
This function is used to combine distances to compute the distance of a path. The
CombineFunction type must be a model of Binary Function. The first argument typ
of the binary function must match the value type of the DistanceMap property map
and the second argument type must match the value type of the WeightMap property
map. The result type must be the same type as the distance value type.
Default: closed_plus<D> with D=typename property_traits<DistanceMap>::value_type
इस तरह के एक संयोजन समारोह को परिभाषित करने के लिए वाक्यविन्यास क्या है? मैंने std :: max के साथ घूमने की कोशिश की है, लेकिन मेरा कंपाइलर इसके साथ खुश नहीं प्रतीत होता है।
देते हैं, यह fumbling का थोड़ा अधिक के साथ काम किया। मैंने 'टेम्पलेट टी कंघी (टी एंड ए, टी एंड बी) {वापसी std :: max (a, b) परिभाषित किया है; } ', और मेरे डिजस्ट्रा में पास किया गया। धन्यवाद! –
Balise