View source code
							
							
						
								Display the source code in dmd/dtemplate.d from which this
								page was generated on github.
							
						
							Report a bug
							
						
								If you spot a problem with this page, click here to create a
								Bugzilla issue.
							
						
							
								Improve this page
							
							
					
								Quickly fork, edit online, and submit a pull request for this page.
								Requires a signed-in GitHub account. This works well for small changes.
								If you'd like to make larger changes you may want to consider using
								local clone.
							
						Function dmd.dtemplate.TemplateInstance.isDiscardable
				
						
				final extern(C++) bool isDiscardable();
						
					
				Returns
true if the instances' innards are discardable.
The idea of this function is to see if the template instantiation can be 100% replaced with its eponymous member. All other members can be discarded, even in the compiler to free memory (for example, the template could be expanded in a region allocator, deemed trivial, the end result copied back out independently and the entire region freed), and can be elided entirely from the binary.
The current implementation affects code that generally looks like:
template foo(args...) {
    some_basic_type_or_string helper() { ...since it was the easiest starting point of implementation but it can and should be expanded more later.
Authors
License
					Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.