Download free for 30 days
Sign in
Upload
Language (EN)
Support
Business
Mobile
Social Media
Marketing
Technology
Art & Photos
Career
Design
Education
Presentations & Public Speaking
Government & Nonprofit
Healthcare
Internet
Law
Leadership & Management
Automotive
Engineering
Software
Recruiting & HR
Retail
Sales
Services
Science
Small Business & Entrepreneurship
Food
Environment
Economy & Finance
Data & Analytics
Investor Relations
Sports
Spiritual
News & Politics
Travel
Self Improvement
Real Estate
Entertainment & Humor
Health & Medicine
Devices & Hardware
Lifestyle
Change Language
Language
English
Español
Português
Français
Deutsche
Cancel
Save
EN
Uploaded by
s_i
320 views
コピーの話
新人向けLT用資料【コピーの話】
Engineering
◦
Read more
0
Save
Share
Embed
Embed presentation
Download
Download to read offline
1
/ 14
2
/ 14
3
/ 14
4
/ 14
5
/ 14
6
/ 14
7
/ 14
8
/ 14
9
/ 14
10
/ 14
11
/ 14
12
/ 14
13
/ 14
14
/ 14
More Related Content
PDF
Storytelling For The Web: Integrate Storytelling in your Design Process
by
Chiara Aliotta
PDF
2024 Trend Updates: What Really Works In SEO & Content Marketing
by
Search Engine Journal
PDF
型の話
by
s_i
PPTX
解説?FSharp.Quotations.Compiler
by
bleis tift
PDF
F#の基礎(?)
by
bleis tift
PPTX
Microsoft Learn で C# を学ぶとどんな感じ?
by
m ishizaki
PDF
O/R Mapper Stratumの話
by
SATOSHI TAGOMORI
PDF
Unity3dにおけるus c# boo比較
by
Nobukazu Hanada
Storytelling For The Web: Integrate Storytelling in your Design Process
by
Chiara Aliotta
2024 Trend Updates: What Really Works In SEO & Content Marketing
by
Search Engine Journal
型の話
by
s_i
解説?FSharp.Quotations.Compiler
by
bleis tift
F#の基礎(?)
by
bleis tift
Microsoft Learn で C# を学ぶとどんな感じ?
by
m ishizaki
O/R Mapper Stratumの話
by
SATOSHI TAGOMORI
Unity3dにおけるus c# boo比較
by
Nobukazu Hanada
Featured
PDF
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
by
OECD Directorate for Financial and Enterprise Affairs
PDF
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
by
SocialHRCamp
PDF
2024 State of Marketing Report – by Hubspot
by
Marius Sescu
PDF
Everything You Need To Know About ChatGPT
by
Expeed Software
PDF
Product Design Trends in 2024 | Teenage Engineerings
by
Pixeldarts
PDF
How Race, Age and Gender Shape Attitudes Towards Mental Health
by
ThinkNow
PDF
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
by
marketingartwork
PDF
Skeleton Culture Code
by
Skeleton Technologies
PDF
PEPSICO Presentation to CAGNY Conference Feb 2024
by
Neil Kimberley
PDF
Content Methodology: A Best Practices Report (Webinar)
by
contently
PPTX
How to Prepare For a Successful Job Search for 2024
by
Albert Qian
PDF
Social Media Marketing Trends 2024 // The Global Indie Insights
by
Kurio // The Social Media Age(ncy)
PDF
Trends In Paid Search: Navigating The Digital Landscape In 2024
by
Search Engine Journal
PDF
5 Public speaking tips from TED - Visualized summary
by
SpeakerHub
PDF
ChatGPT and the Future of Work - Clark Boyd
by
Clark Boyd
PDF
Getting into the tech field. what next
by
Tessa Mero
PDF
Google's Just Not That Into You: Understanding Core Updates & Search Intent
by
Lily Ray
PDF
How to have difficult conversations
by
Rajiv Jayarajah, MAppComm, ACC
PDF
Introduction to Data Science
by
Christy Abraham Joy
PDF
Time Management & Productivity - Best Practices
by
Vit Horky
Artificial Intelligence, Data and Competition – SCHREPEL – June 2024 OECD dis...
by
OECD Directorate for Financial and Enterprise Affairs
How to Leverage AI to Boost Employee Wellness - Lydia Di Francesco - SocialHR...
by
SocialHRCamp
2024 State of Marketing Report – by Hubspot
by
Marius Sescu
Everything You Need To Know About ChatGPT
by
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
by
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
by
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
by
marketingartwork
Skeleton Culture Code
by
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
by
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
by
contently
How to Prepare For a Successful Job Search for 2024
by
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
by
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
by
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
by
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
by
Clark Boyd
Getting into the tech field. what next
by
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
by
Lily Ray
How to have difficult conversations
by
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
by
Christy Abraham Joy
Time Management & Productivity - Best Practices
by
Vit Horky
コピーの話
1.
2019/3/14 Marp Web
(under construction) http://localhost:8080/ 1/14 コピーの話
2.
2019/3/14 Marp Web
(under construction) http://localhost:8080/ 2/14 コピーには2種類がある シャローコピー(ShallowCopy) ディープコピー(DeepCopy)
3.
2019/3/14 Marp Web
(under construction) http://localhost:8080/ 3/14 シャローコピー コピー元とコピー先がメモリ上の同じデータ(インスタンス変数)を参照している 中身は同じ 名前が違うだけ AさんのシャローコピーであるBさんを殴ると、Bさんだけでなくコピー元のAさん もダメージを受けるような感じ
4.
2019/3/14 Marp Web
(under construction) http://localhost:8080/ 4/14 ディープコピー オブジェクトのみのコピーではなく、オブジェクトとメモリ上のデータ(インスタ ンス変数)の両方をコピーする 完全に別物のクローンを作るイメージ AさんのディープコピーであるBさんを殴ると、ダメージを受けるのはBさんだけ というイメージ
5.
2019/3/14 Marp Web
(under construction) http://localhost:8080/ 5/14 C/C++だと ポインタみたいなもん というかポインタ 多分ポインタ 参照渡しとか値渡しとかそのへんの話
6.
2019/3/14 Marp Web
(under construction) http://localhost:8080/ 6/14 rubyで分かりやすく
7.
2019/3/14 Marp Web
(under construction) http://localhost:8080/ 7/14 = による複製 =によってオブジェクトを複製すると、両者は名前が違うだけの同じ中身を参照す ることになる なので、破壊的変更を加えると複製元も先も変わる
8.
2019/3/14 Marp Web
(under construction) http://localhost:8080/ 8/14 例として hoge = [5 ,4 ,3 ,2 ,1] foo = hoge foo.sort! foo # => [1, 2, 3, 4, 5] hoge # => [1, 2, 3, 4, 5] fooをsort!したのにhogeも変わってしまった!
9.
2019/3/14 Marp Web
(under construction) http://localhost:8080/ 9/14 dup/cloneによる複製 dupとcloneの違いはここでは取り上げない hoge = [5, 4, 3, 2 ,1] foo = hoge.dup foo.sort! foo # => [1, 2, 3, 4, 5] hoge # => [5, 4, 3, 2, 1] お、いけてる!
10.
2019/3/14 Marp Web
(under construction) http://localhost:8080/ 10/14 と思いきや hoge = [5, 4, 3, 2, 1] foo = [hoge] # => [[5, 4, 3, 2, 1]] bar = foo.dup bar[0].sort! bar # => [[1, 2, 3, 4, 5]] foo # => [[1, 2, 3, 4, 5]] あ、あれ~~~。。。 なぜかfooも変わっちゃってんじゃん!
11.
2019/3/14 Marp Web
(under construction) http://localhost:8080/ 11/14 実はdup、cloneも浅いコピー(シャローコピー) dup,cloneは、複製するオブジェクト自体は別物になる(ガワは別物) しかしそれに含まれるオブジェクトの参照先はそのままコピー なので最初に例に挙げた配列みたいなものだとintegerをそのままコピーするだけ なので別物になる 2次元配列などになってくると、中にあるオブジェクトの参照先情報などもコピー されてしまう つまり、dupでコピーされるのは自分自身のオブジェクトだけ
12.
2019/3/14 Marp Web
(under construction) http://localhost:8080/ 12/14 結論 コピーには2種類ある シャローコピー(ShallowCopy) ディープコピー(DeepCopy) オブジェクト意識せずに破壊的メソッド使うと痛い目を見る(かもね) 意識しておくと、いつかどこかで損しなくなるかも
13.
2019/3/14 Marp Web
(under construction) http://localhost:8080/ 13/14 余談
14.
2019/3/14 Marp Web
(under construction) http://localhost:8080/ 14/14 じゃあディープコピーするにはどうしたらええねん プレーンなruby Rubyのデータ構造を文字列にエンコード・デコードするMarshalモジュールを使う b = Marshal.load(Marshal.dump(a)) railsなら ActiveSupportのdeep_dupを使う b = a.deep_dup
Download