From bec9266159e5ceab1306a6c946cb1f520915a5c1 Mon Sep 17 00:00:00 2001 From: Mark Santaniello Date: Tue, 16 Aug 2022 16:17:29 -0700 Subject: [PATCH 1/2] Bugfix duplicate symbol error in time_measure.hpp Summary: Test Plan: Reviewers: Subscribers: Tasks: Tags: --- include/boost/sort/common/time_measure.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/sort/common/time_measure.hpp b/include/boost/sort/common/time_measure.hpp index 2660c7b..595f60d 100644 --- a/include/boost/sort/common/time_measure.hpp +++ b/include/boost/sort/common/time_measure.hpp @@ -39,7 +39,7 @@ double subtract_time ( const time_point & t1, const time_point & t2 ); /// @brief return the time system in a internal format ( steady_clock) /// @return time in steady_clock format //--------------------------------------------------------------------------- -time_point now ( ) { return chrn::steady_clock::now( ); }; +inline time_point now ( ) { return chrn::steady_clock::now( ); }; // //--------------------------------------------------------------------------- // function : subtract_time @@ -48,7 +48,7 @@ time_point now ( ) { return chrn::steady_clock::now( ); }; /// @param [in] t2 : second time in time_point format /// @return time in seconds of the difference of t1 - t2 //--------------------------------------------------------------------------- -double subtract_time ( const time_point & t1, const time_point & t2 ) +inline double subtract_time ( const time_point & t1, const time_point & t2 ) { //------------------------ begin --------------------------------- chrn::duration time_span = chrn::duration_cast < chrn::duration < double > > ( t1 - t2 ); From df83d0e33748e172137b3b069c8ca92fb33cb592 Mon Sep 17 00:00:00 2001 From: Mark Santaniello Date: Tue, 16 Aug 2022 16:17:29 -0700 Subject: [PATCH 2/2] Bugfix duplicate symbol error in time_measure.hpp Free functions that are defined in header files must be qualified inline in order to avoid duplicate symbol errors at link time. Bugfix two cases: - boost::sort::common::now() - boost::sort::common::subtract_time() --- include/boost/sort/common/time_measure.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/boost/sort/common/time_measure.hpp b/include/boost/sort/common/time_measure.hpp index 2660c7b..595f60d 100644 --- a/include/boost/sort/common/time_measure.hpp +++ b/include/boost/sort/common/time_measure.hpp @@ -39,7 +39,7 @@ double subtract_time ( const time_point & t1, const time_point & t2 ); /// @brief return the time system in a internal format ( steady_clock) /// @return time in steady_clock format //--------------------------------------------------------------------------- -time_point now ( ) { return chrn::steady_clock::now( ); }; +inline time_point now ( ) { return chrn::steady_clock::now( ); }; // //--------------------------------------------------------------------------- // function : subtract_time @@ -48,7 +48,7 @@ time_point now ( ) { return chrn::steady_clock::now( ); }; /// @param [in] t2 : second time in time_point format /// @return time in seconds of the difference of t1 - t2 //--------------------------------------------------------------------------- -double subtract_time ( const time_point & t1, const time_point & t2 ) +inline double subtract_time ( const time_point & t1, const time_point & t2 ) { //------------------------ begin --------------------------------- chrn::duration time_span = chrn::duration_cast < chrn::duration < double > > ( t1 - t2 );