#include <iostream>
using namespace std;
class FakeArgument_A1{
} fake_argument_a1;
class FakeArgument_B1 : public FakeArgument_A1{
} fake_argument_b1;
struct Iterator{
char data;
};
class Allocator_traits{
public:
template<typename InputIterator>
void construct_range(const InputIterator &it, int n, const FakeArgument_A1* = NULL){
printf("1");
}
template<typename InputIterator, typename _Tp>
void construct_range(const InputIterator &it, const int n, const _Tp &value, const FakeArgument_A1* = NULL){
printf("2");
}
template<typename OutputIterator, typename InputIterator>
void construct_range(const OutputIterator &it, const InputIterator &_first, const InputIterator &_last, const FakeArgument_A1* = NULL){
printf("3");
}
};
class Allocator : public Allocator_traits{
public:
#ifdef __cplusplus
using Allocator_traits::construct_range;
#endif
template<typename InputIterator>
void construct_range(const InputIterator &it, int n, const FakeArgument_A1* = NULL){
printf("4");
}
};
void OnStart(){
Iterator it = {};
Allocator alloc;
alloc.construct_range(it, it, it); // Compile Error: False Positive Warnings - deprecated behavior, hidden method calling will be disabled in a future MQL compiler version
alloc.construct_range<Iterator, Iterator>(it, it, it); // Compile Error: 'construct_range' - wrong template parameters count
alloc.construct_range(it, it, it, (FakeArgument_B1*)NULL); // Bypass False Positive Warnings - "deprecated behavior"
const int n = 5;
const int value = 0;
//alloc.construct_range(it, n, value); // Compile Error: Ok, should be: 'construct_range' - ambiguous call to overloaded function
//alloc.construct_range(it, n, value, (FakeArgument_B1*)NULL); // OK. Compile Error: - 'construct_range' - ambiguous call to overloaded function
}
int main(){
OnStart();
return 0;
}