Prior to Swift 1.2, the as operator could be used to carry out two different kinds of conversion, depending on the type of expression being converted and the type it was being converted to:

  • Guaranteed conversion of a value of one type to another, whose success can be verified by the Swift compiler. For example, upcasting (i.e., converting from a class to one of its superclasses) or specifying the type of a literal expression, (e.g., 1 as Float).
  • Forced conversion of one value to another, whose safety cannot be guaranteed by the Swift compiler and which may cause a runtime trap. For example downcasting, converting from a class to one of its subclasses.

https://developer.apple.com/swift/blog/?id=23

The as! Operator的更多相关文章

  1. The Safe Navigation Operator (&.) in Ruby

    The most interesting addition to Ruby 2.3.0 is the Safe Navigation Operator(&.). A similar opera ...

  2. Blender 脚本之 Operator 初探

    addon(插件)用来扩展 Blender 的功能,跟其他软件里的 plugin(插件)一样,去掉不会影响软件的运行.插件可以加到 Blender 的用户偏好设置目录里,或者就在你所编辑的.blend ...

  3. Sequence Project Showplan Operator 序列映射运算符

    Sequence Project Showplan Operator 序列映射运算符 序列映射运算符会从一个已经排序的集合里通过不停添加集合里的列执行计算. 运算符根据一个或多个列的值把输入集合分为多 ...

  4. [c++] Operator overloading

    c++的操蛋属性:自己为一档,空一档,其他随意. UB_stack a; UB_stack b = a; // copy auto c = a; auto d {a}; // (or auto d = ...

  5. EC笔记:第二部分:11:在operator=中处理“自我赋值”

    已经一年半没有写过博客了,最近发现学过的知识还是需要整理一下,为知笔记,要开始收费了以前写在为知笔记上笔记也会慢慢的转到博客里. 话不多说,进入正题. 考虑考虑以下场景: 当某个对象对自身赋值时,会出 ...

  6. Swift学习(一):自定义运算符 operator

    自定义运算符仅能包含这些字符: / = - + * % < >!& | ^.~ 运算符位置: 前置运算符 prefix 中间运算符 infix 后置运算符 postfix 运算符其 ...

  7. Bash 4.4 中新增的 ${parameter@operator} 语法

    Bash 4.4 中新增了一种 ${...} 语法,长这样:${parameter@operator}.根据不同的 operator,它展开后的值可能是 parameter 这个参数的值经过某种转换后 ...

  8. 为什么operator>>(istream&, string&)能够安全地读入长度未知的字符串?

    一般而言,实现"读入用户输入的字符串",程序中自然不能对用户输入的长度有所限定.这在C++中很容易实现,而在C中确没那么容易. 这一疑问,我在刚学C++的时候也在脑中闪现过:不过很 ...

  9. tensorflow添加自定义的auc计算operator

    tensorflow可以很方便的添加用户自定义的operator(如果不添加也可以采用sklearn的auc计算函数或者自己写一个 但是会在python执行,这里希望在graph中也就是c++端执行这 ...

  10. Flink – window operator

      参考, http://wuchong.me/blog/2016/05/25/flink-internals-window-mechanism/ http://wuchong.me/blog/201 ...

随机推荐

  1. hdu 4950

    #include<stdio.h> int main(){ __int64 h,a,b,k,j=0; while(scanf("%I64d%I64d%I64d%I64d" ...

  2. [bzoj2060][Usaco2010 Nov]Visiting Cows 拜访奶牛_树形dp

    Visiting Cows 拜访奶牛 bzoj-2060 Usaco-2010 Nov 题目大意:题目链接. 注释:略. 想法:看起来像支配集. 只是看起来像而已. 状态:dp[pos][flag]表 ...

  3. Spring MVC 注解基础

    @Controller @Controller 注解用于标记在 Java 类上.被 @Controller 标记过的类就是一个 SpringMVC Controller对象.DispatcherSer ...

  4. iOS:去除UITableView的空白行

    要去除UITableView在运行时显示的多余空白行,只需要将TableView的Style从Plain改为Grouped即可.

  5. HIHO 16 C

    树分治.对于一棵子树的根节点,至少有一条边与儿子相连的属于重边.对于一条轻边,它的贡献值是两端子树大小的乘积,所以,重边应该是贡献值最大的一边. 至于要求所有的点,进行深度优先搜索,因为移动一个点只会 ...

  6. [Java][Spring][scurity]同步session控制,防止一个用户多次登录

    [Spring][scurity]同步session控制.防止一个用户多次登录 假设你希望限制单个用户仅仅能登录到你的程序一次,Spring Security通过加入以下简单的部分支持这个功能. 1. ...

  7. 使用Memcached改进Java企业级应用性能:架构和设置

    Memcached由Danga Interactive开发.用来提升LiveJournal.com站点性能. Memcached分布式架构支持众多的社交网络应用,Twitter.Facebook还有W ...

  8. 一张图告诉你Git的所有命令

  9. Django网站管理--ModelAdmin

    class AuthorAdmin(admin.ModelAdmin): list_display=('name', 'age', 'sex') #指定要显示的字段 search_fields=('n ...

  10. 浅析android适配器adapter中的那些坑

    做项目中遇到的,折磨了我将近两天,今天把经验分享出来.让大家以后少走点弯路,好了.简单来说一下什么是android的适配器,怎样定义.怎样添加适配器的重用性.怎样去减少程序的耦合性 适配器顾名思义是用 ...