Sha256: 90586e6019fed4ec91b28df52029fe4f457b395073612e2453bd1527e1cff6e2
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
require 'ludy/array/combos' module Kernel # forward template functions' generator def for_template_parameters_within range, modifiers = ['volatile', 'const volatile'] modifiers = ['', 'const'] + modifiers range.to_a.map_with_index{ |size, i| ([(["T"]*modifiers.size).zip( modifiers, ['&']*modifiers.size)]*size). map_with_index{ |args, arg_i| args.map{ |arg| # e.g., T0 const& a "#{arg.first}#{arg_i} #{arg.tail.join} #{(arg_i+10).to_s(36)}" } }.combos.map{ |arg| arg.kind_of?(Array) ? arg.join(', ') : arg } }.flatten.each{ |args_list| yield args_list } end # parameter for template def template_parameters args_list size = args_list.count(',') + 1 '<' + (['class T']*size).map_with_index{ |t, index| "#{t}#{index}" }.join(', ') + '>' end # the parameters' list def forward_parameters args_list args_list end # the arguments it passed def arguments args_list size = args_list.count(',') + 1 Array.new(size).map_with_index{ |not_important, i| (i+10).to_s 36 }.join(', ') end end # of ludy
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ludy-0.1.0 | lib/ludy/tasks/erb_cpp/template_forward_parameters.rb |