• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ type类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中type的典型用法代码示例。如果您正苦于以下问题:C++ type类的具体用法?C++ type怎么用?C++ type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了type类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1:

bool ndt::categorical_kind_type::match(
    const char *DYND_UNUSED(arrmeta), const type &candidate_tp,
    const char *DYND_UNUSED(candidate_arrmeta),
    std::map<std::string, type> &DYND_UNUSED(tp_vars)) const
{
  return candidate_tp.get_type_id() == categorical_type_id;
}
开发者ID:jonathandedwards,项目名称:libdynd,代码行数:7,代码来源:categorical_kind_type.cpp


示例2: clear_vector

void sequence::clear_vector (type &vectorobject)
{
	for(size_t i = 0; i < vectorobject.size(); i++)
	{
		delete vectorobject[i];
	}
}
开发者ID:rajeshpillai,项目名称:HexEdit,代码行数:7,代码来源:sequence.cpp


示例3: if

bool ndt::time_type::is_lossless_assignment(const type &dst_tp,
                                            const type &src_tp) const
{
  if (dst_tp.extended() == this) {
    if (src_tp.extended() == this) {
      return true;
    } else if (src_tp.get_type_id() == time_type_id) {
      // There is only one possibility for the time type (TODO: timezones!)
      return true;
    } else {
      return false;
    }
  } else {
    return false;
  }
}
开发者ID:Laeeth,项目名称:libdynd,代码行数:16,代码来源:time_type.cpp


示例4: gmpNumToString

		std::string FractalTexture::gmpNumToString(type num, int base) {
			std::string s;
#ifdef ROE_FRACTAL_USE_GMP
			long exp;
#ifdef ROE_FRACTAL_GMP_USE_C
			s = mpf_get_str(nullptr, &exp, base, 0, num);
#else
			s = num.get_str(exp, base, 0);
#endif
			std::string sign = "";
			if(s.length() == 0) {s="00"; ++exp;}
			if(s[0] == '-') {sign = "-"; s = s.substr(1);}
			while (exp <= 0) {
				s = "0"+s;
				++exp;
			}
			while (exp >= (long)s.length()) {
				s += "0";
			}
			s.insert(exp, ".");//*/
			s = sign + s;
#else
			s = util::toString((double)num);
#endif
			return s;
		}
开发者ID:swantescholz,项目名称:coding,代码行数:26,代码来源:RoeFractalTexture.cpp


示例5: fill

 static void fill(type& v, std::size_t num_of_elems, T const& val) {
     for (std::size_t elem = 0; elem < num_of_elems; ++elem) {
         typename vecvec<T, level - 1>::type child;
         vecvec<T, level - 1>::fill(child, num_of_elems, val);
         v.push_back(child);
     }
 }
开发者ID:SEL4PROJ,项目名称:projects_libs,代码行数:7,代码来源:speed_test_nested_array.cpp


示例6: make_tuple_comparison_kernel

size_t ndt::tuple_type::make_comparison_kernel(
    void *ckb, intptr_t ckb_offset, const type &src0_tp,
    const char *src0_arrmeta, const type &src1_tp, const char *src1_arrmeta,
    comparison_type_t comptype, const eval::eval_context *ectx) const
{
  if (this == src0_tp.extended()) {
    if (*this == *src1_tp.extended()) {
      return make_tuple_comparison_kernel(
          ckb, ckb_offset, src0_tp, src0_arrmeta, src1_arrmeta, comptype, ectx);
    } else if (src1_tp.get_kind() == tuple_kind) {
      // TODO
    }
  }

  throw not_comparable_error(src0_tp, src1_tp, comptype);
}
开发者ID:cpcloud,项目名称:libdynd,代码行数:16,代码来源:tuple_type.cpp


示例7: extract_dependencies

dependencies extract_dependencies(const types_by_name &known_types, const type &for_type)
{
	assert(!for_type.is_empty());

	auto interfaces = extract_interfaces(for_type);
	auto setters = extract_setters(known_types, for_type);
	for (auto &&setter : setters)
	{
		auto parameter_type = setter.parameter_type();
		if (parameter_type == for_type)
			throw exception::dependency_on_self{};
		if (std::find(std::begin(interfaces), std::end(interfaces), parameter_type) != std::end(interfaces))
			throw exception::dependency_on_supertype{};
		auto parameter_interfaces = extract_interfaces(parameter_type);
		if (std::find(std::begin(parameter_interfaces), std::end(parameter_interfaces), for_type) != std::end(parameter_interfaces))
			throw exception::dependency_on_subtype{};
	}

	auto result = std::vector<dependency>{};
	std::transform(std::begin(setters), std::end(setters), std::back_inserter(result),
		[](const setter_method &setter){ return dependency{setter}; }
	);

	return dependencies{result};
}
开发者ID:ovz,项目名称:injeqt,代码行数:25,代码来源:dependencies.cpp


示例8: switch

bool ndt::fixed_dim_type::match(const char *arrmeta, const type &candidate_tp,
                                const char *candidate_arrmeta,
                                std::map<std::string, type> &tp_vars) const
{
  switch (candidate_tp.get_type_id()) {
  case fixed_dim_type_id:
    // TODO XXX If the arrmeta is not NULL, the strides should be checked too
    return get_fixed_dim_size() ==
               candidate_tp.extended<fixed_dim_type>()->get_fixed_dim_size() &&
           m_element_tp.match(
               (arrmeta == NULL) ? arrmeta
                                 : (arrmeta + sizeof(fixed_dim_type_arrmeta)),
               candidate_tp.extended<fixed_dim_type>()->m_element_tp,
               (candidate_arrmeta == NULL)
                   ? candidate_arrmeta
                   : (candidate_arrmeta + sizeof(fixed_dim_type_arrmeta)),
               tp_vars);
  case c_contiguous_type_id:
    return is_c_contiguous(arrmeta) &&
           match(arrmeta,
                 candidate_tp.extended<c_contiguous_type>()->get_child_type(),
                 candidate_arrmeta, tp_vars);
  default:
    return false;
  }
}
开发者ID:cpcloud,项目名称:libdynd,代码行数:26,代码来源:fixed_dim_type.cpp


示例9: assert

bool
eq_algo::operator()(const type& a, const type& b) const
{
  assert(a.get_kind() == b.get_kind());
  switch (a.get_kind()) {
    case void_type_kind:
      return eq_void_type(cast<void_type>(a), cast<void_type>(b));
    case ref_type_kind:
      return eq_ref_type(cast<ref_type>(a), cast<ref_type>(b));
    case fn_type_kind:
      return eq_fn_type(cast<fn_type>(a), cast<fn_type>(b));
    default:
      break;
  }
  assert(false && "not a common type");
}
开发者ID:asutton,项目名称:beaker,代码行数:16,代码来源:eq.cpp


示例10: const_cast_

 expression const_cast_(
   const std::shared_ptr< llvm::LLVMContext > &context,
   const std::shared_ptr< ir_builder_t > &ir_builder,
   const type cast_to,
   const expression &value
 ) {
   if(
     type_traits::is_reference( value.type() ) ||
     type_traits::is_pointer( value.type() )
   ) {
     if(
       value.type().which() == cast_to.which()
     ) return remove_const_cast( context, ir_builder, cast_to, value );
     else if(
       type_traits::is_reference( value.type() ) &&
       type_traits::is_pointer( cast_to )
     ) {
       const auto dereferenced = remove_reference( context, ir_builder, value );
       return const_cast_( context, ir_builder, cast_to, dereferenced );
     }
     else if(
       type_traits::is_rvalue_reference( value.type() ) &&
       type_traits::is_lvalue_reference( cast_to )
     ) return reference_cast( context, ir_builder, cast_to, value );
   }
   throw exceptions::invalid_cast();
 }
开发者ID:Fadis,项目名称:dlambda,代码行数:27,代码来源:const_cast.cpp


示例11:

bool ndt::callable_type::match(const char *arrmeta, const type &candidate_tp,
                               const char *candidate_arrmeta,
                               std::map<nd::string, type> &tp_vars) const
{
  if (candidate_tp.get_type_id() != callable_type_id) {
    return false;
  }

  // First match the return type
  if (!m_return_type.match(
          arrmeta, candidate_tp.extended<callable_type>()->m_return_type,
          candidate_arrmeta, tp_vars)) {
    return false;
  }

  // Next match all the positional parameters
  if (!m_pos_tuple.match(arrmeta,
                         candidate_tp.extended<callable_type>()->m_pos_tuple,
                         candidate_arrmeta, tp_vars)) {
    return false;
  }

  // Finally match all the keyword parameters
  if (!m_kwd_struct.match(
          arrmeta, candidate_tp.extended<callable_type>()->get_kwd_struct(),
          candidate_arrmeta, tp_vars)) {
    return false;
  }

  return true;
}
开发者ID:Laeeth,项目名称:libdynd,代码行数:31,代码来源:callable_type.cpp


示例12:

bool ndt::fixed_string_kind_type::match(
    const char *DYND_UNUSED(arrmeta), const type &candidate_tp,
    const char *DYND_UNUSED(candidate_arrmeta),
    std::map<nd::string, type> &DYND_UNUSED(tp_vars)) const
{
  return candidate_tp.get_type_id() == fixed_string_type_id;
}
开发者ID:Laeeth,项目名称:libdynd,代码行数:7,代码来源:fixed_string_kind_type.cpp


示例13: if

bool ndt::fixed_bytes_type::is_lossless_assignment(const type &dst_tp,
                                                   const type &src_tp) const
{
  if (dst_tp.extended() == this) {
    if (src_tp.extended() == this) {
      return true;
    } else if (src_tp.get_type_id() == fixed_bytes_type_id) {
      const fixed_bytes_type *src_fs =
          static_cast<const fixed_bytes_type *>(src_tp.extended());
      return get_data_size() == src_fs->get_data_size();
    } else {
      return false;
    }
  } else {
    return false;
  }
}
开发者ID:cpcloud,项目名称:libdynd,代码行数:17,代码来源:fixed_bytes_type.cpp


示例14:

bool ndt::kind_sym_type::match(
    const char *DYND_UNUSED(arrmeta), const type &candidate_tp,
    const char *DYND_UNUSED(candidate_arrmeta),
    std::map<nd::string, type> &DYND_UNUSED(tp_vars)) const
{
  // Matches against the 'kind' of the candidate type
  return candidate_tp.get_kind() == m_kind;
}
开发者ID:gmarkall,项目名称:libdynd,代码行数:8,代码来源:kind_sym_type.cpp


示例15:

bool ndt::scalar_kind_type::match(
    const char *DYND_UNUSED(arrmeta), const type &candidate_tp,
    const char *DYND_UNUSED(candidate_arrmeta),
    std::map<std::string, type> &DYND_UNUSED(tp_vars)) const
{
  // Match against any scalar
  return candidate_tp.is_scalar();
}
开发者ID:cpcloud,项目名称:libdynd,代码行数:8,代码来源:scalar_kind_type.cpp


示例16:

bool ndt::pointer_type::is_lossless_assignment(const type &dst_tp, const type &src_tp) const
{
    if (dst_tp.extended() == this) {
        return ::is_lossless_assignment(m_target_tp, src_tp);
    } else {
        return ::is_lossless_assignment(dst_tp, m_target_tp);
    }
}
开发者ID:gitter-badger,项目名称:libdynd,代码行数:8,代码来源:pointer_type.cpp


示例17:

bool ndt::option_type::match(const type &candidate_tp, std::map<std::string, type> &tp_vars) const
{
  if (candidate_tp.get_id() != option_id) {
    return false;
  }

  return m_value_tp.match(candidate_tp.extended<option_type>()->m_value_tp, tp_vars);
}
开发者ID:nyue,项目名称:libdynd,代码行数:8,代码来源:option_type.cpp


示例18: switch

intptr_t ndt::bytes_type::make_assignment_kernel(void *ckb, intptr_t ckb_offset, const type &dst_tp,
        const char *dst_arrmeta, const type &src_tp, const char *src_arrmeta,
        kernel_request_t kernreq, const eval::eval_context *ectx) const
{
    if (this == dst_tp.extended()) {
        switch (src_tp.get_type_id()) {
        case bytes_type_id: {
            return make_blockref_bytes_assignment_kernel(ckb, ckb_offset, get_data_alignment(), dst_arrmeta,
                    src_tp.get_data_alignment(), src_arrmeta, kernreq, ectx);
        }
        case fixed_bytes_type_id: {
            return make_fixed_bytes_to_blockref_bytes_assignment_kernel(ckb, ckb_offset, get_data_alignment(), dst_arrmeta,
                    src_tp.get_data_size(), src_tp.get_data_alignment(),
                    kernreq, ectx);
        }
        default: {
            if (!src_tp.is_builtin()) {
                src_tp.extended()->make_assignment_kernel(ckb, ckb_offset, dst_tp, dst_arrmeta, src_tp, src_arrmeta, kernreq,
                        ectx);
            }
            break;
        }
        }
    }

    stringstream ss;
    ss << "Cannot assign from " << src_tp << " to " << dst_tp;
    throw runtime_error(ss.str());
}
开发者ID:hainm,项目名称:libdynd,代码行数:29,代码来源:bytes_type.cpp


示例19: make_callable_to_string_assignment_kernel

intptr_t ndt::callable_type::make_assignment_kernel(void *ckb, intptr_t ckb_offset, const type &dst_tp,
                                                    const char *dst_arrmeta, const type &src_tp,
                                                    const char *DYND_UNUSED(src_arrmeta), kernel_request_t kernreq,
                                                    const eval::eval_context *ectx) const
{
  if (this == dst_tp.extended()) {
  } else {
    if (dst_tp.get_kind() == string_kind) {
      // Assignment to strings
      return make_callable_to_string_assignment_kernel(ckb, ckb_offset, dst_tp, dst_arrmeta, src_tp, kernreq, ectx);
    }
  }

  // Nothing can be assigned to/from callable
  stringstream ss;
  ss << "Cannot assign from " << src_tp << " to " << dst_tp;
  throw dynd::type_error(ss.str());
}
开发者ID:melodylail,项目名称:libdynd,代码行数:18,代码来源:callable_type.cpp


示例20: make_builtin_type_comparison_kernel

size_t ndt::time_type::make_comparison_kernel(
    void *ckb, intptr_t ckb_offset, const type &src0_tp,
    const char *src0_arrmeta, const type &src1_tp, const char *src1_arrmeta,
    comparison_type_t comptype, const eval::eval_context *ectx) const
{
  if (this == src0_tp.extended()) {
    if (*this == *src1_tp.extended()) {
      return make_builtin_type_comparison_kernel(ckb, ckb_offset, int64_type_id,
                                                 int64_type_id, comptype);
    } else if (!src1_tp.is_builtin()) {
      return src1_tp.extended()->make_comparison_kernel(
          ckb, ckb_offset, src0_tp, src0_arrmeta, src1_tp, src1_arrmeta,
          comptype, ectx);
    }
  }

  throw not_comparable_error(src0_tp, src1_tp, comptype);
}
开发者ID:cpcloud,项目名称:libdynd,代码行数:18,代码来源:time_type.cpp



注:本文中的type类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ typeArrayOop类代码示例发布时间:2022-05-31
下一篇:
C++ txXPathNode类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap