Code Monkey home page Code Monkey logo

Comments (4)

Lcat12345 avatar Lcat12345 commented on July 23, 2024

비주얼 스튜디오에서는 컴파일에 전혀 문제가 없는데 고쳐야 할까요?
image

경고 역시 뜨지 않습니다.

from cpp-study.

Woon-2 avatar Woon-2 commented on July 23, 2024

두 가지 가능성이 있습니다.

  • 위 코드는 단순 friend 선언이기 때문에 안쪽 T를 사용할 일이 없어 Visual Studio 컴파일러가 영리하게 처리했다.
  • Visual Studio 컴파일러는 변수의 이름이 겹치는 경우처럼, 안쪽 범위의 typename을 우선 사용하는 규칙이 있다.

중첩 template을 사용할 때 바깥 범위의 typename과 안쪽 범위의 typename을 같은 것을 써서 좋을 것이 없습니다.

  • 코드를 읽을 때 어떤 typename을 말하는 것인지 모호하게 느껴집니다.

  • 저는 gdb online debugger IDE를 사용해 작업했는데, 이것은 컴파일러로 gcc를 이용합니다.
    C/C++의 대표적인 컴파일러 gcc로 컴파일이 불가능하다면, 코드 수정을 고려해봐야겠죠.

    • 웬만하면 어떤 컴파일러를 쓰는 지와 무관하게 컴파일 가능한 게 좋습니다.

from cpp-study.

Lcat12345 avatar Lcat12345 commented on July 23, 2024

수정 완료하였습니다. 템플릿을 쓴다는 것은 무척이나 까다롭군요.
이슈는 꼭 제가 닫아야 하는건가요?

from cpp-study.

Woon-2 avatar Woon-2 commented on July 23, 2024

그걸 처음에는 Issue를 작성한 사람(지금이라면 저)이 닫도록 해야겠다고 생각했는데,
Commit MessageClose #32 과 같이 작성하면 Issue를 닫을 수 있다는 사실을 발견해서,
이 경우엔 Commit 작성자가 Issue를 닫는 게 효율적이니 어떻게 해야할지 고민입니다.
일단 이 Issue는 제가 닫겠습니다.

from cpp-study.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.