-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generic_factory: support relative & proportional
In the hope of eventually removing the assign() functions, and expanding support for generic factory (and continuing to support existing use cases), generic_factory needs to support relative and proportional. To do this, do some template vodoo. Create two templated structs, and take advantage of SFINAE (yeah, I had to look that up) with these to determine which template function to use. Three basically discriminate between whether or not the type can specify value proportionally or relatively. For proportionally, this is whether or not the type can be multiplied by a float, and for relative, this is whether or not the type can use the += operator with itself. Also, add some error checking for when a proportional value is inappropriately specified. Containers using the reader functions do not have proportional and relative support, because I'm not sure of a use case where that ever makes sense. Huge thanks to jbytheway for helping me use template vodoo to accomplish this.
- Loading branch information
1 parent
c055a7c
commit 514a9d8
Showing
1 changed file
with
209 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters