Gmane
From: Robert Kawulak <kawulak <at> student.agh.edu.pl>
Subject: Re: [constrained-value] zero-overhead
Newsgroups: gmane.comp.lib.boost.devel
Date: 2007-08-31 02:11:45 GMT (1 year, 1 week, 18 hours and 23 minutes ago)
> From: Neal Becker
> I want to use this like logging - where I can 
> switch it off at compile time and make the overhead negligible.

I wrote a simple test function:

	int test()
	{
	    bounded_int<int, -3, 7>::type b(5);
	    b++;
	    b -= 1;
	    return b;
	}

I compiled it with gcc 4.01, optimisations turned on. I had to add explicit
'inline' to several functions, and then the assembler output was as follows:

	__Z4testv:
	LFB1019:
		pushl	%ebp
	LCFI17:
		movl	$5, %eax
		movl	%esp, %ebp
	LCFI18:
		popl	%ebp
		ret

I dare to say it couldn't be optimised more now... ;-)

Best regards,
Robert

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost