mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 14:02:46 +00:00 
			
		
		
		
	AK: Inline *String::is_one_of<Ts...>()
Previously this was generating a crazy number of symbols, and it was also pretty-damn-slow as it was defined recursively, which made the compiler incapable of inlining it (due to the many many layers of recursion before it terminated). This commit replaces the recursion with a pack expansion and marks it always-inline.
This commit is contained in:
		
							parent
							
								
									a446530c0d
								
							
						
					
					
						commit
						824a40e95b
					
				
					 3 changed files with 9 additions and 21 deletions
				
			
		|  | @ -76,17 +76,13 @@ public: | |||
| 
 | ||||
|     static void did_destroy_impl(Badge<StringImpl>, StringImpl&); | ||||
| 
 | ||||
|     template<typename T, typename... Rest> | ||||
|     bool is_one_of(const T& string, Rest... rest) const | ||||
|     template<typename... Ts> | ||||
|     [[nodiscard]] ALWAYS_INLINE constexpr bool is_one_of(Ts... strings) const | ||||
|     { | ||||
|         if (*this == string) | ||||
|             return true; | ||||
|         return is_one_of(rest...); | ||||
|         return (... || this->operator==(forward<Ts>(strings))); | ||||
|     } | ||||
| 
 | ||||
| private: | ||||
|     bool is_one_of() const { return false; } | ||||
| 
 | ||||
|     RefPtr<StringImpl> m_impl; | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Ali Mohammad Pur
						Ali Mohammad Pur