Submit Search
Upload
C++ extension methods
•
0 likes
•
3,561 views
P
phil_nash
Follow
A 5 minute (or just over) lightning talk I did at ACCU2013
Read less
Read more
Technology
Health & Medicine
Report
Share
Report
Share
1 of 26
Download now
Download to read offline
Recommended
OODP Unit 1 OOPs classes and objects
OODP Unit 1 OOPs classes and objects
Shanmuganathan C
What's Wrong With Object-Oriented Programming?
What's Wrong With Object-Oriented Programming?
Yegor Bugayenko
[Pycon KR 2017] Rst와 함께하는 Python 문서 작성 & OpenStack 문서 활용 사례
[Pycon KR 2017] Rst와 함께하는 Python 문서 작성 & OpenStack 문서 활용 사례
Ian Choi
What is Multithreading In Python | Python Multithreading Tutorial | Edureka
What is Multithreading In Python | Python Multithreading Tutorial | Edureka
Edureka!
Refactoring to Immutability
Refactoring to Immutability
Kevlin Henney
프로그래밍 언어의 F1머신 C++을 타고 Windows 10 UWP 앱 개발의 세계로~
프로그래밍 언어의 F1머신 C++을 타고 Windows 10 UWP 앱 개발의 세계로~
YEONG-CHEON YOU
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009
Martin Odersky
Multi threading
Multi threading
gndu
Recommended
OODP Unit 1 OOPs classes and objects
OODP Unit 1 OOPs classes and objects
Shanmuganathan C
What's Wrong With Object-Oriented Programming?
What's Wrong With Object-Oriented Programming?
Yegor Bugayenko
[Pycon KR 2017] Rst와 함께하는 Python 문서 작성 & OpenStack 문서 활용 사례
[Pycon KR 2017] Rst와 함께하는 Python 문서 작성 & OpenStack 문서 활용 사례
Ian Choi
What is Multithreading In Python | Python Multithreading Tutorial | Edureka
What is Multithreading In Python | Python Multithreading Tutorial | Edureka
Edureka!
Refactoring to Immutability
Refactoring to Immutability
Kevlin Henney
프로그래밍 언어의 F1머신 C++을 타고 Windows 10 UWP 앱 개발의 세계로~
프로그래밍 언어의 F1머신 C++을 타고 Windows 10 UWP 앱 개발의 세계로~
YEONG-CHEON YOU
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009
Martin Odersky
Multi threading
Multi threading
gndu
JAVA THREADS.pdf
JAVA THREADS.pdf
Mohit Kumar
PostgreSQL
PostgreSQL
Amazon Web Services
Autovacuum, explained for engineers, new improved version PGConf.eu 2015 Vienna
Autovacuum, explained for engineers, new improved version PGConf.eu 2015 Vienna
PostgreSQL-Consulting
Clang tidy
Clang tidy
Yury Yafimachau
Graylog is the New Black
Graylog is the New Black
Megan Roddie
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
PgDay.Seoul
Java Multithreading Using Executors Framework
Java Multithreading Using Executors Framework
Arun Mehra
Functional programming
Functional programming
ijcd
[0410 박민근] 기술 면접시 자주 나오는 문제들
[0410 박민근] 기술 면접시 자주 나오는 문제들
MinGeun Park
Input output files in java
Input output files in java
Kavitha713564
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
MinGeun Park
15 algoritmos de busca em tabelas - sequencial e binaria
15 algoritmos de busca em tabelas - sequencial e binaria
Ricardo Bolanho
Node.Js: Basics Concepts and Introduction
Node.Js: Basics Concepts and Introduction
Kanika Gera
Java thread life cycle
Java thread life cycle
Archana Gopinath
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
JDBC: java DataBase connectivity
JDBC: java DataBase connectivity
Tanmoy Barman
Multithreading In Java
Multithreading In Java
parag
Java And Multithreading
Java And Multithreading
Shraddha
Monad Laws Must be Checked
Monad Laws Must be Checked
Philip Schwarz
Virtual machine and javascript engine
Virtual machine and javascript engine
Duoyi Wu
UX, ethnography and possibilities: for Libraries, Museums and Archives
UX, ethnography and possibilities: for Libraries, Museums and Archives
Ned Potter
TDLS8000 Tunable Diode Laser Spectrometer
TDLS8000 Tunable Diode Laser Spectrometer
Yokogawa
More Related Content
What's hot
JAVA THREADS.pdf
JAVA THREADS.pdf
Mohit Kumar
PostgreSQL
PostgreSQL
Amazon Web Services
Autovacuum, explained for engineers, new improved version PGConf.eu 2015 Vienna
Autovacuum, explained for engineers, new improved version PGConf.eu 2015 Vienna
PostgreSQL-Consulting
Clang tidy
Clang tidy
Yury Yafimachau
Graylog is the New Black
Graylog is the New Black
Megan Roddie
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
PgDay.Seoul
Java Multithreading Using Executors Framework
Java Multithreading Using Executors Framework
Arun Mehra
Functional programming
Functional programming
ijcd
[0410 박민근] 기술 면접시 자주 나오는 문제들
[0410 박민근] 기술 면접시 자주 나오는 문제들
MinGeun Park
Input output files in java
Input output files in java
Kavitha713564
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
MinGeun Park
15 algoritmos de busca em tabelas - sequencial e binaria
15 algoritmos de busca em tabelas - sequencial e binaria
Ricardo Bolanho
Node.Js: Basics Concepts and Introduction
Node.Js: Basics Concepts and Introduction
Kanika Gera
Java thread life cycle
Java thread life cycle
Archana Gopinath
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
Aniruddha Chakrabarti
JDBC: java DataBase connectivity
JDBC: java DataBase connectivity
Tanmoy Barman
Multithreading In Java
Multithreading In Java
parag
Java And Multithreading
Java And Multithreading
Shraddha
Monad Laws Must be Checked
Monad Laws Must be Checked
Philip Schwarz
Virtual machine and javascript engine
Virtual machine and javascript engine
Duoyi Wu
What's hot
(20)
JAVA THREADS.pdf
JAVA THREADS.pdf
PostgreSQL
PostgreSQL
Autovacuum, explained for engineers, new improved version PGConf.eu 2015 Vienna
Autovacuum, explained for engineers, new improved version PGConf.eu 2015 Vienna
Clang tidy
Clang tidy
Graylog is the New Black
Graylog is the New Black
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
[Pgday.Seoul 2021] 2. Porting Oracle UDF and Optimization
Java Multithreading Using Executors Framework
Java Multithreading Using Executors Framework
Functional programming
Functional programming
[0410 박민근] 기술 면접시 자주 나오는 문제들
[0410 박민근] 기술 면접시 자주 나오는 문제들
Input output files in java
Input output files in java
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
15 algoritmos de busca em tabelas - sequencial e binaria
15 algoritmos de busca em tabelas - sequencial e binaria
Node.Js: Basics Concepts and Introduction
Node.Js: Basics Concepts and Introduction
Java thread life cycle
Java thread life cycle
Golang - Overview of Go (golang) Language
Golang - Overview of Go (golang) Language
JDBC: java DataBase connectivity
JDBC: java DataBase connectivity
Multithreading In Java
Multithreading In Java
Java And Multithreading
Java And Multithreading
Monad Laws Must be Checked
Monad Laws Must be Checked
Virtual machine and javascript engine
Virtual machine and javascript engine
Viewers also liked
UX, ethnography and possibilities: for Libraries, Museums and Archives
UX, ethnography and possibilities: for Libraries, Museums and Archives
Ned Potter
TDLS8000 Tunable Diode Laser Spectrometer
TDLS8000 Tunable Diode Laser Spectrometer
Yokogawa
Soil Degradation
Soil Degradation
Michael Newbold
Participatory extension method
Participatory extension method
G B Pant University of Agriculture & Technology, Pantnagar, (U S Nagar), Uttarakhand, India
Extension approaches
Extension approaches
Marxism
Farmer Management System
Farmer Management System
Technical Centre for Agricultural and Rural Cooperation ACP-EU (CTA)
Farm management
Farm management
Nadia
Stomatal function and cam photosynthesis
Stomatal function and cam photosynthesis
Mark McGinley
AGRI 4411 Farm Management Chapter 2
AGRI 4411 Farm Management Chapter 2
Rita Conley
2nd lecture on Farm Management
2nd lecture on Farm Management
Ministry of Animal Resources & Fisheries
Pra methods
Pra methods
kppaul2009
Soil degradation and regeneration
Soil degradation and regeneration
Bijesh Mishra
Poultry Farm Management System
Poultry Farm Management System
bimoljit
Web Based Agriculture Information System
Web Based Agriculture Information System
Gihan Wikramanayake
Agricultural Extension and Communication
Agricultural Extension and Communication
Karl Obispo
Participatory Research and Extension Approaches (PREA)
Participatory Research and Extension Approaches (PREA)
africa-rising
Current approaches in extension
Current approaches in extension
Yagnesh sondarva
Performance Management System
Performance Management System
Mayank Singh
Soil degradation
Soil degradation
Dhakshinamoorthy Maikandadevan
Final ppt
Final ppt
Jyoti Jha
Viewers also liked
(20)
UX, ethnography and possibilities: for Libraries, Museums and Archives
UX, ethnography and possibilities: for Libraries, Museums and Archives
TDLS8000 Tunable Diode Laser Spectrometer
TDLS8000 Tunable Diode Laser Spectrometer
Soil Degradation
Soil Degradation
Participatory extension method
Participatory extension method
Extension approaches
Extension approaches
Farmer Management System
Farmer Management System
Farm management
Farm management
Stomatal function and cam photosynthesis
Stomatal function and cam photosynthesis
AGRI 4411 Farm Management Chapter 2
AGRI 4411 Farm Management Chapter 2
2nd lecture on Farm Management
2nd lecture on Farm Management
Pra methods
Pra methods
Soil degradation and regeneration
Soil degradation and regeneration
Poultry Farm Management System
Poultry Farm Management System
Web Based Agriculture Information System
Web Based Agriculture Information System
Agricultural Extension and Communication
Agricultural Extension and Communication
Participatory Research and Extension Approaches (PREA)
Participatory Research and Extension Approaches (PREA)
Current approaches in extension
Current approaches in extension
Performance Management System
Performance Management System
Soil degradation
Soil degradation
Final ppt
Final ppt
Similar to C++ extension methods
An Introduction to Part of C++ STL
An Introduction to Part of C++ STL
乐群 陈
Oop objects_classes
Oop objects_classes
sidra tauseef
include ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdf
naslin841216
C++11 - STL Additions
C++11 - STL Additions
GlobalLogic Ukraine
C++11 - A Change in Style - v2.0
C++11 - A Change in Style - v2.0
Yaser Zhian
Templates in C++
Templates in C++
Tech_MX
Please code in C++ and do only the �TO DO�s and all of them. There a.pdf
Please code in C++ and do only the �TO DO�s and all of them. There a.pdf
farankureshi
Monadic Comprehensions and Functional Composition with Query Expressions
Monadic Comprehensions and Functional Composition with Query Expressions
Chris Eargle
Алексей Кутумов, Вектор с нуля
Алексей Кутумов, Вектор с нуля
Sergey Platonov
Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...
Codemotion
C++11
C++11
Sasha Goldshtein
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
tdc-globalcode
Статичный SQL в С++14. Евгений Захаров ➠ CoreHard Autumn 2019
Статичный SQL в С++14. Евгений Захаров ➠ CoreHard Autumn 2019
corehard_by
Matuura cpp
Matuura cpp
matuura_core
The STL
The STL
adil raja
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
DIPESH30
C++ Lambda and concurrency
C++ Lambda and concurrency
명신 김
C++ Nested loops, matrix and fuctions.pdf
C++ Nested loops, matrix and fuctions.pdf
yamew16788
Functional C++
Functional C++
Kevlin Henney
Aho-Corasick string matching algorithm
Aho-Corasick string matching algorithm
Takatoshi Kondo
Similar to C++ extension methods
(20)
An Introduction to Part of C++ STL
An Introduction to Part of C++ STL
Oop objects_classes
Oop objects_classes
include ltfunctionalgt include ltiteratorgt inclu.pdf
include ltfunctionalgt include ltiteratorgt inclu.pdf
C++11 - STL Additions
C++11 - STL Additions
C++11 - A Change in Style - v2.0
C++11 - A Change in Style - v2.0
Templates in C++
Templates in C++
Please code in C++ and do only the �TO DO�s and all of them. There a.pdf
Please code in C++ and do only the �TO DO�s and all of them. There a.pdf
Monadic Comprehensions and Functional Composition with Query Expressions
Monadic Comprehensions and Functional Composition with Query Expressions
Алексей Кутумов, Вектор с нуля
Алексей Кутумов, Вектор с нуля
Laziness, trampolines, monoids and other functional amenities: this is not yo...
Laziness, trampolines, monoids and other functional amenities: this is not yo...
C++11
C++11
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
TDC2016POA | Trilha .NET - C# como você nunca viu: conceitos avançados de pro...
Статичный SQL в С++14. Евгений Захаров ➠ CoreHard Autumn 2019
Статичный SQL в С++14. Евгений Захаров ➠ CoreHard Autumn 2019
Matuura cpp
Matuura cpp
The STL
The STL
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
lab08build.bat@echo offclsset DRIVE_LETTER=1s.docx
C++ Lambda and concurrency
C++ Lambda and concurrency
C++ Nested loops, matrix and fuctions.pdf
C++ Nested loops, matrix and fuctions.pdf
Functional C++
Functional C++
Aho-Corasick string matching algorithm
Aho-Corasick string matching algorithm
Recently uploaded
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
johnbeverley2021
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
UiPathCommunity
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
Nanddeep Nachan
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
ThousandEyes
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Angeliki Cooney
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Jeffrey Haguewood
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
apidays
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Orbitshub
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
sudhanshuwaghmare1
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
MIND CTI
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
Dropbox
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Product Anonymous
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
apidays
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
WSO2
Elevate Developer Efficiency & build GenAI Application with Amazon Q
Elevate Developer Efficiency & build GenAI Application with Amazon Q
Bhuvaneswari Subramani
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
DianaGray10
Recently uploaded
(20)
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
Elevate Developer Efficiency & build GenAI Application with Amazon Q
Elevate Developer Efficiency & build GenAI Application with Amazon Q
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
C++ extension methods
1.
C++ Ext
e n s i o @phil_nash n Methods
2.
class A: foo()
bar() data
3.
class A: foo()
+ explode() ? bar() data
4.
Dynamic languages?
5.
setattr(cls, func.__name__,
types.MethodType(func, cls))
6.
setattr(cls, func.__name__,
types.MethodType(func, cls)) var a = {}; a.f1 = function(){};
7.
setattr(cls, func.__name__,
types.MethodType(func, cls)) var a = {}; a.f1 = function(){}; struct objc_method myMethod; myMethod.method_name = sel_registerName("sayHello"); myMethod.method_imp = sayHello; struct objc_method_list * myMethodList; myMethodList = malloc (sizeof(struct objc_method_list)); myMethodList-‐>method_count = 1; myMethodList-‐>method_list[0] = myMethod; class_addMethods ( [EmptyClass class], myMethodList );
8.
Static languages?
9.
namespace ExtensionMethods {
public static class MyExtensions { public static int WordCount(this String str) { return str.Split(new char[] { ' ', '.', '?' }, StringSplitOptions.RemoveEmptyEntries).Length; } } }
10.
namespace ExtensionMethods {
public static class MyExtensions { public static int WordCount(this String str) { return str.Split(new char[] { ' ', '.', '?' }, StringSplitOptions.RemoveEmptyEntries).Length; } } } @implementation NSString (reverse) -(NSString *) reverseString { NSMutableString *reversedStr; int len = [self length]; reversedStr = [NSMutableString stringWithCapacity:len]; while (len > 0) [reversedStr appendString: [NSString stringWithFormat:@"%C", [self characterAtIndex:--len]]]; return reversedStr; }
11.
C++ ?
12.
The C++
Interface principle
13.
namespace NS {
class T { }; void f( T ); } int main() { NS::T object; f(object); }
14.
namespace NS {
class T { }; void f( T ); } int main() { NS::T object; object.f(); }
15.
namespace NS {
class T { }; void f( T ); } int main() { NS::T* object = new NS::T(); object-‐>f(); }
16.
object-‐>f()
17.
object<-‐f()
18.
19.
struct Widget :
Extendible<Widget> { Widget( int size, int weight ) : size( size ), weight( weight ) {} int size; int weight; };
20.
struct Widget :
Extendible<Widget> { Widget( int size, int weight ) : size( size ), weight( weight ) {} int size; int weight; }; struct print : ExtMethod<print> { void operator()( Widget& w ) { std::cout << "size: " << w.size << ", weight: " << w.weight << std::endl; } }; Widget w( 4, 10 ); w<-print();
21.
struct Widget :
Extendible<Widget> { Widget( int size, int weight ) : size( size ), weight( weight ) {} int size; int weight; }; struct print : ExtMethod<print> { void operator()( Widget& w ) { std::cout << "size: " << w.size << ", weight: " << w.weight << std::endl; } }; struct density : ExtMethod<density, float> { float operator()( Widget& w ) { return (float)(w.weight / w.size); } }; Widget w( 4, 10 ); w<-print(); float d = w<-density();
22.
23.
template<typename T, typename
ReturnT=void> struct ExtMethod { ExtMethod& operator - () { return *this; } template<typename U> ReturnT operator()( U& obj ) { return static_cast<T*>(this)->operator()( obj ); } }; template<typename Derived> struct Extendible { template<typename T, typename ReturnT> ReturnT operator < ( ExtMethod<T, ReturnT>& extMethod ) { return extMethod( static_cast<Derived&>( *this ) ); } };
24.
25.
template<typename T, typename
ReturnT=void> struct ExtMethod { ExtMethod& operator - () { return *this; } template<typename U> ReturnT operator()( U& obj ) { return static_cast<T*>(this)->operator()( obj ); } }; template<typename Derived> struct Extendible { template<typename T, typename ReturnT> ReturnT operator < ( ExtMethod<T, ReturnT>& extMethod ) { return extMethod( static_cast<Derived&>( *this ) ); } };
26.
template<typename T, typename
ReturnT=void> struct ExtMethod { e! ExtMethod& operator - () { } return *this; c od template<typename U> ion ct ReturnT operator()( U& obj ) { u return static_cast<T*>(this)->operator()( obj ); d ro } }; in p this do template<typename Derived> n ’t struct Extendible { o se d template<typename T, typename ReturnT> ea ReturnT operator < ( ExtMethod<T, ReturnT>& extMethod ) { Pl }; } return extMethod( static_cast<Derived&>( *this ) );
Download now