dogfootman.com

  • 홈
  • 태그
  • 방명록

append 1

[Go] 슬라이스의 얕은 복사와 깊은 복사 (Shallow Copy and Deep Copy of Slices)

개요 슬라이스의 얕은 복사와 깊은 복사에 대해서 1. 얕은 복사 package main import ( "fmt" "sort" ) type obj struct { Name string Age int32 } func main() { list1 := []*obj{ {Name: "A", Age: 1}, {Name: "B", Age: 2}, {Name: "C", Age: 3}, } list2 := list1 sort.Slice(list2, func(i, j int) bool { return list2[i].Age < list2[j].Age }) fmt.Printf("List1 [%p]\n", list1) for _, item := range list1 { fmt.Printf("Name: %s, Age: %d [..

[Go] 2023.08.03
이전
1
다음
더보기
  • View All Categories (13)
    • [Unity] (3)
      • [Unity 2D] (3)
    • [Go] (9)
    • [ETC] (1)

Tag

cycle not allowed, Dependency, Slice, API, Golang, Unity 2D, Camera, Unity, deep copy, mouse position, struct, pre-request script, test, Interface, 고랭, Performance, go, gob, benchmark, scroll wheel,

최근글과 인기글

  • 최근글
  • 인기글

방문자수Total

  • Today :
  • Yesterday :

Copyright © Kakao Corp. All rights reserved.

티스토리툴바