fix compilation
- remove wrong comments - fix include guard footer - add curly braces - add template specialization for std::vector<bool> in make_array - reformat
This commit is contained in:
parent
76aa494be4
commit
20091e94c8
@ -25,9 +25,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// based on
|
|
||||||
// https://svn.apache.org/repos/asf/mesos/tags/release-0.9.0-incubating-RC0/src/common/json.hpp
|
|
||||||
|
|
||||||
#ifndef JSON_UTIL_HPP
|
#ifndef JSON_UTIL_HPP
|
||||||
#define JSON_UTIL_HPP
|
#define JSON_UTIL_HPP
|
||||||
|
|
||||||
@ -75,7 +72,20 @@ template <typename T> osrm::json::Array make_array(const std::vector<T>& vector)
|
|||||||
{
|
{
|
||||||
osrm::json::Array a;
|
osrm::json::Array a;
|
||||||
for (const auto &v : vector)
|
for (const auto &v : vector)
|
||||||
|
{
|
||||||
a.values.emplace_back(v);
|
a.values.emplace_back(v);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
|
// template specialization needed as clang does not play nice
|
||||||
|
template <> osrm::json::Array make_array(const std::vector<bool> &vector)
|
||||||
|
{
|
||||||
|
osrm::json::Array a;
|
||||||
|
for (const bool v : vector)
|
||||||
|
{
|
||||||
|
a.values.emplace_back(v);
|
||||||
|
}
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,4 +108,4 @@ osrm::json::Value& get(osrm::json::Value& value, unsigned key, Keys... keys)
|
|||||||
|
|
||||||
} // namespace json
|
} // namespace json
|
||||||
} // namespace osrm
|
} // namespace osrm
|
||||||
#endif // JSON_RENDERER_HPP
|
#endif // JSON_UTIL_HPP
|
||||||
|
Loading…
Reference in New Issue
Block a user