remove implicit inline keyword from header files
This commit is contained in:
		
							parent
							
								
									57fab61789
								
							
						
					
					
						commit
						d92f022041
					
				| @ -51,7 +51,7 @@ namespace filesystem | |||||||
| // exists. The validate() function must be defined in the same namespace
 | // exists. The validate() function must be defined in the same namespace
 | ||||||
| // as the target type, (boost::filesystem::path in this case), otherwise
 | // as the target type, (boost::filesystem::path in this case), otherwise
 | ||||||
| // it is not called
 | // it is not called
 | ||||||
| // inline void validate(
 | // void validate(
 | ||||||
| //     boost::any & v,
 | //     boost::any & v,
 | ||||||
| //     const std::vector<std::string> & values,
 | //     const std::vector<std::string> & values,
 | ||||||
| //     boost::filesystem::path *,
 | //     boost::filesystem::path *,
 | ||||||
| @ -71,7 +71,7 @@ namespace filesystem | |||||||
| 
 | 
 | ||||||
| // adapted from:
 | // adapted from:
 | ||||||
| // http://stackoverflow.com/questions/1746136/how-do-i-normalize-a-pathname-using-boostfilesystem
 | // http://stackoverflow.com/questions/1746136/how-do-i-normalize-a-pathname-using-boostfilesystem
 | ||||||
| inline boost::filesystem::path | boost::filesystem::path | ||||||
| portable_canonical(const boost::filesystem::path &relative_path, | portable_canonical(const boost::filesystem::path &relative_path, | ||||||
|                    const boost::filesystem::path ¤t_path = boost::filesystem::current_path()) |                    const boost::filesystem::path ¤t_path = boost::filesystem::current_path()) | ||||||
| { | { | ||||||
| @ -118,7 +118,7 @@ portable_canonical(const boost::filesystem::path &relative_path, | |||||||
| 
 | 
 | ||||||
| #if BOOST_FILESYSTEM_VERSION < 3 | #if BOOST_FILESYSTEM_VERSION < 3 | ||||||
| 
 | 
 | ||||||
| inline path temp_directory_path() | path temp_directory_path() | ||||||
| { | { | ||||||
|     char *buffer; |     char *buffer; | ||||||
|     buffer = tmpnam(nullptr); |     buffer = tmpnam(nullptr); | ||||||
| @ -126,7 +126,7 @@ inline path temp_directory_path() | |||||||
|     return path(buffer); |     return path(buffer); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| inline path unique_path(const path &) { return temp_directory_path(); } | path unique_path(const path &) { return temp_directory_path(); } | ||||||
| 
 | 
 | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
| @ -136,7 +136,7 @@ inline path unique_path(const path &) { return temp_directory_path(); } | |||||||
| #define BOOST_FILESYSTEM_VERSION 3 | #define BOOST_FILESYSTEM_VERSION 3 | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| inline void AssertPathExists(const boost::filesystem::path &path) | void AssertPathExists(const boost::filesystem::path &path) | ||||||
| { | { | ||||||
|     if (!boost::filesystem::is_regular_file(path)) |     if (!boost::filesystem::is_regular_file(path)) | ||||||
|     { |     { | ||||||
|  | |||||||
| @ -37,7 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| 
 | 
 | ||||||
| /* Get angle of line segment (A,C)->(C,B), atan2 magic, formerly cosine theorem*/ | /* Get angle of line segment (A,C)->(C,B), atan2 magic, formerly cosine theorem*/ | ||||||
| template <class CoordinateT> | template <class CoordinateT> | ||||||
| inline static double GetAngleBetweenThreeFixedPointCoordinates(const CoordinateT &A, | static double GetAngleBetweenThreeFixedPointCoordinates(const CoordinateT &A, | ||||||
|                                                                const CoordinateT &C, |                                                                const CoordinateT &C, | ||||||
|                                                                const CoordinateT &B) |                                                                const CoordinateT &B) | ||||||
| { | { | ||||||
| @ -46,10 +46,10 @@ inline static double GetAngleBetweenThreeFixedPointCoordinates(const CoordinateT | |||||||
|     const double v2x = (B.lon - C.lon) / COORDINATE_PRECISION; |     const double v2x = (B.lon - C.lon) / COORDINATE_PRECISION; | ||||||
|     const double v2y = lat2y(B.lat / COORDINATE_PRECISION) - lat2y(C.lat / COORDINATE_PRECISION); |     const double v2y = lat2y(B.lat / COORDINATE_PRECISION) - lat2y(C.lat / COORDINATE_PRECISION); | ||||||
| 
 | 
 | ||||||
|     double angle = (atan2_lookup(v2y, v2x) - atan2_lookup(v1y, v1x)) * 180 / M_PI; |     double angle = (atan2_lookup(v2y, v2x) - atan2_lookup(v1y, v1x)) * 180. / M_PI; | ||||||
|     while (angle < 0) |     while (angle < 0.) | ||||||
|     { |     { | ||||||
|         angle += 360; |         angle += 360.; | ||||||
|     } |     } | ||||||
|     return angle; |     return angle; | ||||||
| } | } | ||||||
|  | |||||||
| @ -31,20 +31,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| #include <algorithm> | #include <algorithm> | ||||||
| #include <vector> | #include <vector> | ||||||
| 
 | 
 | ||||||
| template <typename T> inline void sort_unique_resize(std::vector<T> &vector) | template <typename T> void sort_unique_resize(std::vector<T> &vector) | ||||||
| { | { | ||||||
|     std::sort(vector.begin(), vector.end()); |     std::sort(vector.begin(), vector.end()); | ||||||
|     const auto number_of_unique_elements = std::unique(vector.begin(), vector.end()) - vector.begin(); |     const auto number_of_unique_elements = std::unique(vector.begin(), vector.end()) - vector.begin(); | ||||||
|     vector.resize(number_of_unique_elements); |     vector.resize(number_of_unique_elements); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // template <typename T> inline void sort_unique_resize_shrink_vector(std::vector<T> &vector)
 | // template <typename T> void sort_unique_resize_shrink_vector(std::vector<T> &vector)
 | ||||||
| // {
 | // {
 | ||||||
| //     sort_unique_resize(vector);
 | //     sort_unique_resize(vector);
 | ||||||
| //     vector.shrink_to_fit();
 | //     vector.shrink_to_fit();
 | ||||||
| // }
 | // }
 | ||||||
| 
 | 
 | ||||||
| // template <typename T> inline void remove_consecutive_duplicates_from_vector(std::vector<T> &vector)
 | // template <typename T> void remove_consecutive_duplicates_from_vector(std::vector<T> &vector)
 | ||||||
| // {
 | // {
 | ||||||
| //     const auto number_of_unique_elements = std::unique(vector.begin(), vector.end()) - vector.begin();
 | //     const auto number_of_unique_elements = std::unique(vector.begin(), vector.end()) - vector.begin();
 | ||||||
| //     vector.resize(number_of_unique_elements);
 | //     vector.resize(number_of_unique_elements);
 | ||||||
|  | |||||||
| @ -43,7 +43,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| #include <string> | #include <string> | ||||||
| 
 | 
 | ||||||
| // generate boost::program_options object for the routing part
 | // generate boost::program_options object for the routing part
 | ||||||
| inline bool GenerateDataStoreOptions(const int argc, const char *argv[], ServerPaths &paths, bool & springclean) | bool GenerateDataStoreOptions(const int argc, const char *argv[], ServerPaths &paths, bool & springclean) | ||||||
| { | { | ||||||
|     // declare a group of options that will be allowed only on command line
 |     // declare a group of options that will be allowed only on command line
 | ||||||
|     boost::program_options::options_description generic_options("Options"); |     boost::program_options::options_description generic_options("Options"); | ||||||
|  | |||||||
| @ -33,7 +33,7 @@ enum Endianness | |||||||
|   BigEndian = 2 }; |   BigEndian = 2 }; | ||||||
| 
 | 
 | ||||||
| // Function is optimized to a single 'mov eax,1' on GCC, clang and icc using -O3
 | // Function is optimized to a single 'mov eax,1' on GCC, clang and icc using -O3
 | ||||||
| inline Endianness GetMachineEndianness() | Endianness GetMachineEndianness() | ||||||
| { | { | ||||||
|     int i(1); |     int i(1); | ||||||
|     char *p = (char *)&i; |     char *p = (char *)&i; | ||||||
| @ -45,7 +45,7 @@ inline Endianness GetMachineEndianness() | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // Reverses Network Byte Order into something usable, compiles down to a bswap-mov combination
 | // Reverses Network Byte Order into something usable, compiles down to a bswap-mov combination
 | ||||||
| inline unsigned SwapEndian(unsigned x) | unsigned SwapEndian(unsigned x) | ||||||
| { | { | ||||||
|     if (GetMachineEndianness() == LittleEndian) |     if (GetMachineEndianness() == LittleEndian) | ||||||
|     { |     { | ||||||
|  | |||||||
| @ -31,7 +31,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| 
 | 
 | ||||||
| #include <limits> | #include <limits> | ||||||
| 
 | 
 | ||||||
| template <typename FloatT> inline bool EpsilonCompare(const FloatT d1, const FloatT d2) | template <typename FloatT> bool EpsilonCompare(const FloatT d1, const FloatT d2) | ||||||
| { | { | ||||||
|     return (std::abs(d1 - d2) < std::numeric_limits<FloatT>::epsilon()); |     return (std::abs(d1 - d2) < std::numeric_limits<FloatT>::epsilon()); | ||||||
| } | } | ||||||
|  | |||||||
| @ -33,26 +33,26 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| // this is largely inspired by boost's hash combine as can be found in
 | // this is largely inspired by boost's hash combine as can be found in
 | ||||||
| // "The C++ Standard Library" 2nd Edition. Nicolai M. Josuttis. 2012.
 | // "The C++ Standard Library" 2nd Edition. Nicolai M. Josuttis. 2012.
 | ||||||
| template<typename T> | template<typename T> | ||||||
| inline void hash_combine(std::size_t &seed, const T& val) | void hash_combine(std::size_t &seed, const T& val) | ||||||
| { | { | ||||||
|     seed ^= std::hash<T>()(val) + 0x9e3779b9 + (seed << 6) + (seed >> 2); |     seed ^= std::hash<T>()(val) + 0x9e3779b9 + (seed << 6) + (seed >> 2); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| template<typename T> | template<typename T> | ||||||
| inline void hash_val(std::size_t &seed, const T& val) | void hash_val(std::size_t &seed, const T& val) | ||||||
| { | { | ||||||
|     hash_combine(seed, val); |     hash_combine(seed, val); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| template<typename T, typename ... Types> | template<typename T, typename ... Types> | ||||||
| inline void hash_val(std::size_t &seed, const T& val, const Types& ... args) | void hash_val(std::size_t &seed, const T& val, const Types& ... args) | ||||||
| { | { | ||||||
|     hash_combine(seed, val); |     hash_combine(seed, val); | ||||||
|     hash_val(seed, args ...); |     hash_val(seed, args ...); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| template<typename ... Types> | template<typename ... Types> | ||||||
| inline std::size_t hash_val( const Types&... args) | std::size_t hash_val( const Types&... args) | ||||||
| { | { | ||||||
|     std::size_t seed = 0; |     std::size_t seed = 0; | ||||||
|     hash_val(seed, args...); |     hash_val(seed, args...); | ||||||
|  | |||||||
| @ -29,13 +29,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |||||||
| #define STRINGUTIL_H | #define STRINGUTIL_H | ||||||
| 
 | 
 | ||||||
| #include <boost/algorithm/string.hpp> | #include <boost/algorithm/string.hpp> | ||||||
| #include <boost/spirit/include/karma.hpp> |  | ||||||
| #include <boost/spirit/include/qi.hpp> |  | ||||||
| 
 | 
 | ||||||
| #include <cstdio> | #include <cstdio> | ||||||
| #include <cctype> | #include <cctype> | ||||||
| #include <string> | #include <string> | ||||||
| #include <type_traits> |  | ||||||
| #include <vector> | #include <vector> | ||||||
| 
 | 
 | ||||||
| // precision:  position after decimal point
 | // precision:  position after decimal point
 | ||||||
| @ -74,149 +71,6 @@ template <int length, int precision> static inline char *printInt(char *buffer, | |||||||
|     return buffer; |     return buffer; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // convert scoped enums to integers
 |  | ||||||
| template <typename Enumeration> |  | ||||||
| auto as_integer(Enumeration const value) -> typename std::underlying_type<Enumeration>::type |  | ||||||
| { |  | ||||||
|     return static_cast<typename std::underlying_type<Enumeration>::type>(value); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| template <typename Number> |  | ||||||
| static inline typename std::enable_if<std::is_integral<Number>::value, std::string>::type |  | ||||||
| IntegralToString(const Number value) |  | ||||||
| { |  | ||||||
|     std::string output; |  | ||||||
|     std::back_insert_iterator<std::string> sink(output); |  | ||||||
| 
 |  | ||||||
|     if (8 == sizeof(Number)) |  | ||||||
|     { |  | ||||||
|         boost::spirit::karma::generate(sink, boost::spirit::karma::long_long, value); |  | ||||||
|     } |  | ||||||
|     else |  | ||||||
|     { |  | ||||||
|         if (std::is_signed<Number>::value) |  | ||||||
|         { |  | ||||||
|             boost::spirit::karma::generate(sink, boost::spirit::karma::int_, value); |  | ||||||
|         } |  | ||||||
|         else |  | ||||||
|         { |  | ||||||
|             boost::spirit::karma::generate(sink, boost::spirit::karma::uint_, value); |  | ||||||
|         } |  | ||||||
|     } |  | ||||||
|     return output; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static inline int StringToInt(const std::string &input) |  | ||||||
| { |  | ||||||
|     auto first_digit = input.begin(); |  | ||||||
|     // Delete any trailing white-spaces
 |  | ||||||
|     while (first_digit != input.end() && std::isspace(*first_digit)) |  | ||||||
|     { |  | ||||||
|         ++first_digit; |  | ||||||
|     } |  | ||||||
|     int value = 0; |  | ||||||
|     boost::spirit::qi::parse(first_digit, input.end(), boost::spirit::int_, value); |  | ||||||
|     return value; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static inline unsigned StringToUint(const std::string &input) |  | ||||||
| { |  | ||||||
|     auto first_digit = input.begin(); |  | ||||||
|     // Delete any trailing white-spaces
 |  | ||||||
|     while (first_digit != input.end() && (std::isspace(*first_digit) || '-' == *first_digit)) |  | ||||||
|     { |  | ||||||
|         ++first_digit; |  | ||||||
|     } |  | ||||||
|     unsigned value = 0; |  | ||||||
|     boost::spirit::qi::parse(first_digit, input.end(), boost::spirit::uint_, value); |  | ||||||
|     return value; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static inline uint64_t StringToInt64(const std::string &input) |  | ||||||
| { |  | ||||||
|     auto first_digit = input.begin(); |  | ||||||
|     // Delete any trailing white-spaces
 |  | ||||||
|     while (first_digit != input.end() && std::isspace(*first_digit)) |  | ||||||
|     { |  | ||||||
|         ++first_digit; |  | ||||||
|     } |  | ||||||
|     uint64_t value = 0; |  | ||||||
|     boost::spirit::qi::parse(first_digit, input.end(), boost::spirit::long_long, value); |  | ||||||
|     return value; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| // source: http://tinodidriksen.com/2011/05/28/cpp-convert-string-to-double-speed/
 |  | ||||||
| static inline double StringToDouble(const char *p) |  | ||||||
| { |  | ||||||
|     double r = 0.0; |  | ||||||
|     bool neg = false; |  | ||||||
|     if (*p == '-') |  | ||||||
|     { |  | ||||||
|         neg = true; |  | ||||||
|         ++p; |  | ||||||
|     } |  | ||||||
|     while (*p >= '0' && *p <= '9') |  | ||||||
|     { |  | ||||||
|         r = (r * 10.0) + (*p - '0'); |  | ||||||
|         ++p; |  | ||||||
|     } |  | ||||||
|     if (*p == '.') |  | ||||||
|     { |  | ||||||
|         double f = 0.0; |  | ||||||
|         int n = 0; |  | ||||||
|         ++p; |  | ||||||
|         while (*p >= '0' && *p <= '9') |  | ||||||
|         { |  | ||||||
|             f = (f * 10.0) + (*p - '0'); |  | ||||||
|             ++p; |  | ||||||
|             ++n; |  | ||||||
|         } |  | ||||||
|         r += f / std::pow(10.0, n); |  | ||||||
|     } |  | ||||||
|     if (neg) |  | ||||||
|     { |  | ||||||
|         r = -r; |  | ||||||
|     } |  | ||||||
|     return r; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| template <typename T> struct scientific_policy : boost::spirit::karma::real_policies<T> |  | ||||||
| { |  | ||||||
|     //  we want the numbers always to be in fixed format
 |  | ||||||
|     static int floatfield(T n) { return boost::spirit::karma::real_policies<T>::fmtflags::fixed; } |  | ||||||
|     static unsigned int precision(T) { return 6; } |  | ||||||
| }; |  | ||||||
| typedef boost::spirit::karma::real_generator<double, scientific_policy<double>> science_type; |  | ||||||
| 
 |  | ||||||
| static inline std::string FixedDoubleToString(const double value) |  | ||||||
| { |  | ||||||
|     std::string output; |  | ||||||
|     std::back_insert_iterator<std::string> sink(output); |  | ||||||
|     boost::spirit::karma::generate(sink, science_type(), value); |  | ||||||
|     if (output.size() >= 2 && output[output.size() - 2] == '.' && output[output.size() - 1] == '0') |  | ||||||
|     { |  | ||||||
|         output.resize(output.size() - 2); |  | ||||||
|     } |  | ||||||
|     return output; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static inline std::string DoubleToString(const double value) |  | ||||||
| { |  | ||||||
|     std::string output; |  | ||||||
|     std::back_insert_iterator<std::string> sink(output); |  | ||||||
|     boost::spirit::karma::generate(sink, value); |  | ||||||
|     return output; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| static inline void doubleToStringWithTwoDigitsBehindComma(const double value, std::string &output) |  | ||||||
| { |  | ||||||
|     // The largest 32-bit integer is 4294967295, that is 10 chars
 |  | ||||||
|     // On the safe side, add 1 for sign, and 1 for trailing zero
 |  | ||||||
|     char buffer[12]; |  | ||||||
|     sprintf(buffer, "%g", value); |  | ||||||
|     output = buffer; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| inline void replaceAll(std::string &s, const std::string &sub, const std::string &other) | inline void replaceAll(std::string &s, const std::string &sub, const std::string &other) | ||||||
| { | { | ||||||
|     boost::replace_all(s, sub, other); |     boost::replace_all(s, sub, other); | ||||||
|  | |||||||
| @ -722,7 +722,7 @@ constexpr unsigned short atan_table[4096] = { | |||||||
| // max value is pi/4
 | // max value is pi/4
 | ||||||
| constexpr double SCALING_FACTOR = 4. / M_PI * 0xFFFF; | constexpr double SCALING_FACTOR = 4. / M_PI * 0xFFFF; | ||||||
| 
 | 
 | ||||||
| inline double atan2_lookup(double y, double x) | double atan2_lookup(double y, double x) | ||||||
| { | { | ||||||
|     if (std::abs(x) < std::numeric_limits<double>::epsilon()) |     if (std::abs(x) < std::numeric_limits<double>::epsilon()) | ||||||
|     { |     { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user