/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
#include <type_traits>
using namespace std;
//T = from, U = to
template<bool T, bool U>
struct convertable{};
template<>
struct convertable<true, false>;
template<typename T, bool B>
struct iter{
iter(){}
const static bool is_const_value = B;
template<typename U>
iter(iter<U, true> u){
convertable<u.is_const_value, is_const_value>{};
}
template<typename U>
iter(iter<U, false> u){
convertable<u.is_const_value, is_const_value>{};
}
};
int main()
{
iter<int, false> non_const_int;
iter<int, true> const_int;
iter<int, true> const_from_non{non_const_int};
// iter<int, false> non_from_const{const_int}; // err
return 0;
}