이전 글에 이어서 포스팅 합니다. VC++ 2008에서 TR1 구현을 일부 지원합니다. 이전 프로젝트에서는 Boost C++ Library를 쓰고 있었는데 이런 Library를 연결시키지 않고 컴파일 할 수 있다는 것이 매우 좋은 소식인 것 같습니다.

 
도움말에 첨부된 예제 소스를 일부 공유해봅니다.

// bind.cpp
// compile with /EHsc
#include <functional>
#include <algorithm>
#include <iostream>
 
using namespace std::tr1::placeholders;
 
void square(double x)
    {
    std::cout << x << "^2 == " << x * x << std::endl;
    }
 
void product(double x, double y)
    {
    std::cout << x << "*" << y << " == " << x * y << std::endl;
    }
 
int main()
    {
    double arg[] = {1, 2, 3};
 
    std::for_each(&arg[0], &arg[3], square);
    std::cout << std::endl;
 
    std::for_each(&arg[0], &arg[3], std::tr1::bind(product, _1, 2));
    std::cout << std::endl;
 
    std::for_each(&arg[0], &arg[3], std::tr1::bind(square, _1));
 
    return (0);
    }
1^2 == 1
2^2 == 4
3^2 == 9
 
1*2 == 2
2*2 == 4
3*2 == 6


위에서 처럼 bind()와 placeholder(_1, _2, ... )가 생겨서 함수형 포인터를 다루기가 매우 수월해졌습니다. mem_fn()과 함께 쓴다면, 여러가지 상황에서 응용할 수 있을 것 같습니다.

// sp_construct.cpp
// compile with /EHsc
#include <memory>
#include <iostream>
 
struct deleter
    {
    void operator()(int *p)
        {
        delete p;
        }
    };
 
int main()
    {
    std::tr1::shared_ptr<int> sp0;
    std::cout << "(bool)sp0 == " << std::boolalpha
        << (bool)sp0 << std::endl;
 
    std::tr1::shared_ptr<int> sp1(new int(5));
    std::cout << "*sp1 == " << *sp1 << std::endl;
 
    std::tr1::shared_ptr<int> sp2(new int(10), deleter());
    std::cout << "*sp2 == " << *sp2 << std::endl;
 
    std::tr1::shared_ptr<int> sp3(sp2);
    std::cout << "*sp3 == " << *sp3 << std::endl;
 
    std::tr1::weak_ptr<int> wp(sp3);
    std::tr1::shared_ptr<int> sp4(wp);
    std::cout << "*sp4 == " << *sp4 << std::endl;
 
    std::auto_ptr<int> ap(new int(15));
    std::tr1::shared_ptr<int> sp5(ap);
    std::cout << "*sp5 == " << *sp5 << std::endl;
 
    return (0);
    }
(bool)sp0 == false
*sp1 == 5
*sp2 == 10
*sp3 == 10
*sp4 == 10
*sp5 == 15


TR1 스펙 중에 가장 매력적인 것 중에 하나가 이 shared_ptr/weak_ptr이 아닌가 싶습니다. 포인터를 Class화시켜서 다루면서 알아서 Reference Count계산과 Garbages Collecting을 해주니 C++에서도 Java나 C#처럼 메모리 관리에 대해서 별로 신경 쓰지 않고 프로그래밍 할 수 있습니다. 위의 예제에서처럼 weak_ptr과 shared_ptr간의 상호 변환 그리고, auto_ptr의 이용이 가능합니다.
 ㅎ

Posted by U∙Seung


Microsoft가 Visual Studio 2008 Feature Pack Beta를 발표 하였습니다. 여기에는 Office UI 구현 등 기존의 MFC 확장 기능을 비롯하여, C++ 표준 TR1 구현이 추가 되는 등의 새로운 Feature들을 선보이고 있습니다. 정리된 내용을 요약하면... 아래와 같고, 자세한 내용은 문서를 참조하세요.


VC++ 2008 MFC 라이브러리에 아래와 같은 Application 제작 기능이 추가 되었습니다.
  • Office 리본 스타일 인터페이스
  • Office 2007/2003/XP Look & Feel
  • Visual Studio 스타일 툴바와 Pane
  • Full Customizing 가능한 툴바와 메뉴
  • 고급 GUI Controls
  • 고급 MDI Tabs와 Groups
  • 기타 많은 것들..


또한, C++0x 표준의 TR1이 구현되었습니다.

  • Smart pointers <memory>
  • Regular expression parsing <regex>
  • New containers (tuple, array, unordered set, etc) <unordered_map>, <unordered_set>, <tuple>, <array>
  • Sophisticated random number generators <random>
  • Polymorphic function wrappers <functional>
  • Type traits <type_traits>
  • And more! <utility>



 








Posted by U∙Seung





약간 지난 소식 이지만.. Visual Studio 2008 Shell Runtime을 기반으로하여 IronPython 프로그래밍을 할 수 있는 IDE가 나왔습니다. IronPython Studio라는 녀석이고요, 설치용 다운로드 및 소스코드 다운로드도 가능합니다.

동영상을 보시면 빠른 이해가 되시리라 봅니다만 지원되는 기능을 간략히 나열 해보면...
- Project creation
 -Syntax coloring
- Intellisense
- Debug supporting (break point, watch, locals, autos .. )
- Immediate window
- IronPython console window
  * intellisense in console window
- WinForm Application
- WPF Application
- Code Snippets


설치 방법은...
#1. Microsoft Visual Studio 2008 Shell (isolated mode) Redistributable Package
#2. IronPython Studio December 2007 CTP Setup

을 순서대로 설치하면 됩니다.


Known Issues more...

Posted by U∙Seung
저도 이번엔 링크 위주의 글을 하나 적어 봅니다.

요즘 Visual Studio 2008을 쓰는데 Javascript 기능이 매우 좋아진 것 같습니다.
다른 Visual Studio가 좋은 IDE임은 누구나 다 인정 하지만, 특히 Javascript 에서는 빛을 발한다는 느낌이 듭니다.

Visual Studio 2008에서는 Intellisense기능과 Syntax Check 기능이 강화되었습니다.
사실 Javascript 처럼 Cloure가 지원되는 언어들은 완벽하게 Intellisense를 지원하는데 한계가 있습니다만 Visual Studio가 나름 잘 지원해주는 것 같네요. Syntax Error Check는 자주 Syntax error가 나진 않지만 Run time error에 들어가기전에 한번 걸러준다는 점에서 매우 소중한 기능이고요.


자세한 내용은 아래에..

Javascript Intellisense in Visual Studio 2008
- VS 2008 JavaScript Intellisense
- JScript IntelliSense in Visual Studio Orcas
- More Javascript Intellisense with Visual Studio 2008 Beta 2


Javascript Intellisense for Silverlight
- Javascript Intellisense in VS 2008 for Silverlight 1.0 
- Silverlight 1.0 full Javascript Intellisense


Javascript Syntax Check
- JScript Syntax Check in Visual Web Developer 2008 Beta2



--

참, Visual Web Developer 2008 Expression Edition은 무료로 다운받아서 사용하실 수 있습니다.

Posted by U∙Seung