mirror of
				https://github.com/Zygo/bees.git
				synced 2025-11-03 11:40:34 +01:00 
			
		
		
		
	trace: avoid one copy in every trace function
While investigating https://github.com/Zygo/bees/issues/282 I noticed that we're doing at least one unnecessary extra copy of the functor in BEESTRACE. Get rid of it with a const reference. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
		@@ -49,7 +49,7 @@ BeesTracer::~BeesTracer()
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BeesTracer::BeesTracer(function<void()> f, bool silent) :
 | 
			
		||||
BeesTracer::BeesTracer(const function<void()> &f, bool silent) :
 | 
			
		||||
	m_func(f)
 | 
			
		||||
{
 | 
			
		||||
	m_next_tracer = tl_next_tracer;
 | 
			
		||||
 
 | 
			
		||||
@@ -193,7 +193,7 @@ class BeesTracer {
 | 
			
		||||
	thread_local static bool tl_silent;
 | 
			
		||||
	thread_local static bool tl_first;
 | 
			
		||||
public:
 | 
			
		||||
	BeesTracer(function<void()> f, bool silent = false);
 | 
			
		||||
	BeesTracer(const function<void()> &f, bool silent = false);
 | 
			
		||||
	~BeesTracer();
 | 
			
		||||
	static void trace_now();
 | 
			
		||||
	static bool get_silent();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user