1.0.4 • Published 5 months ago

nv-cli-if-constexpr-timap v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

nv-cli-if-constexpr-timap

install

  • npm install nv-cli-if-constexpr-timap -g

usage

Usage: nv_cli_if_constexpr_timap [options] 
Options:
    -n, --name                   
    -i, --input                 type-name-array .such as ["nvcsp::cmmn::Unknown","void","std::nullptr_t","uint8_t",....]
    -o, --output                output string,default stdout
    -h, --help                  usage

example

	# nv-cli-if-constexpr-timap -n test
	    ["void","std::nullptr_t","uint8_t"]
	// press ctrl+D
	template<size_t I> using test_idx_t = decltype(([]{
	    if constexpr      (I == 0) { return(std::type_identity<nvcsp::cmmn::NotExist>{});}
	    else if constexpr (I == 1) { return(std::type_identity<void                 >{});}
	    else if constexpr (I == 2) { return(std::type_identity<std::nullptr_t       >{});}
	    else if constexpr (I == 3) { return(std::type_identity<uint8_t              >{});}
	    else                         {
		return(std::type_identity<nvcsp::cmmn::Unknown>{});
	    }
	})())::type;

	;

	/*------------------------------*/

	template<typename T> static constexpr uint64_t test_typ_i =([]{
	    if constexpr      (std::is_same_v<T,nvcsp::cmmn::NotExist>) { return(0);}
	    else if constexpr (std::is_same_v<T,void                 >) { return(1);}
	    else if constexpr (std::is_same_v<T,std::nullptr_t       >) { return(2);}
	    else if constexpr (std::is_same_v<T,uint8_t              >) { return(3);}
	    else                         {
		return(std::numeric_limits<uint64_t>::max());
	    }
	})();

	;

LICENSE

  • ISC
1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago