当前位置: 首页>>代码示例>>C++>>正文


C++ copy1函数代码示例

本文整理汇总了C++中copy1函数的典型用法代码示例。如果您正苦于以下问题:C++ copy1函数的具体用法?C++ copy1怎么用?C++ copy1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了copy1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main()
{
	Student s("Anubhav", 22);
	s.printDetails(); //"Anubhav", 22 

	std::cout << "\n\n\n";

	Student copyCall = s; // Copy Contrcutor is called here
	copyCall.printDetails(); //"Anubhav", 22


	Student copy1("Anu", 29);

	copyCall = copy1;
	
	copyCall.printDetails();//"Anu", 29

	s.printDetails();

	
	s.editName_n_Age("Anubhav R", 29);
	s.printDetails();



	system("pause");
	return 0;
}
开发者ID:anubhavrohatgi,项目名称:Cpp-Tutorials,代码行数:28,代码来源:copyConstructor.cpp

示例2: url

// Copy constructor with all the parameter and copy constructor for constructor with request and mimetype as parameter.
void tst_QMediaResource::copyConstructor()
{
    // Initialise all the parameters.
    const QUrl url(QString::fromLatin1("http://test.com/test.mp4"));
    const QString mimeType(QLatin1String("video/mp4"));
    const QString amrCodec(QLatin1String("amr"));
    const QString h264Codec(QLatin1String("h264"));

    const qint64 dataSize(23600);
    int audioBitRate = 1, sampleRate = 2, channelCount = 3, videoBitRate = 4;
    QSize resolution(QSize(640, 480));
    QString language("eng");

    // Create the instance with url and mimetype.
    QMediaResource original(url, mimeType);

    // Set all the parameters.
    original.setAudioCodec(amrCodec);
    original.setLanguage(QString("eng"));
    original.setVideoCodec(h264Codec);
    original.setDataSize(dataSize);
    original.setAudioBitRate(audioBitRate);
    original.setSampleRate(sampleRate);
    original.setChannelCount(channelCount);
    original.setVideoBitRate(videoBitRate);
    original.setResolution(resolution);

    // Copy the instance to new object.
    QMediaResource copy(original);

    // Verify all the parameters of the copied object.
    QCOMPARE(copy.url(), url);
    QCOMPARE(copy.mimeType(), mimeType);
    QCOMPARE(copy.audioCodec(), amrCodec);
    QCOMPARE(copy.language(), language );
    QCOMPARE(copy.videoCodec(), h264Codec);
    QCOMPARE(copy.dataSize(), dataSize);
    QCOMPARE(copy.audioBitRate(), audioBitRate);
    QCOMPARE(copy.sampleRate(), sampleRate);
    QCOMPARE(copy.channelCount(), channelCount);
    QCOMPARE(copy.videoBitRate(), videoBitRate);
    QCOMPARE(copy.resolution(), resolution);

    // Compare both the objects are equal.
    QCOMPARE(original == copy, true);
    QCOMPARE(original != copy, false);

    // Initialise the request parameter.
    QNetworkRequest request1(QUrl(QString::fromLatin1("http://test.com/test.mp4")));

    // Constructor with rerquest and mimetype.
    QMediaResource original1(request1, mimeType);

    // Copy the object and verify if both are eqaul or not.
    QMediaResource copy1(original1);
    QCOMPARE(copy1.url(), url);
    QCOMPARE(copy1.mimeType(), mimeType);
    QCOMPARE(copy1.request(), request1);
    QCOMPARE(original1 == copy1, true);
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:61,代码来源:tst_qmediaresource.cpp

示例3: main

int main()
{
	char X[MONTHS][15];
	char Y[MONTHS][15];
	int i,j;
	char **Z;
	char **ret;
	strcpy(X[0],"January");strcpy(X[1],"February");strcpy(X[2],"March");
	strcpy(X[3],"April");strcpy(X[4],"May"); strcpy(X[5],"June");
	strcpy(X[6],"July");strcpy(X[7],"August");strcpy(X[8],"September");
	strcpy(X[9],"October");strcpy(X[10],"November");strcpy(X[11],"December");

	copy1(X,Y);
	ret=copy2(X);
	copy3(X,&Z);
	printf("Output of copy1 --> Array Y\n");
	for(i=0;i<MONTHS;i++)
			printf("%s\n",Y[i]);
	printf("\n\n\n");

	printf("Output of copy2 --> ret\n");
	for(i=0;i<MONTHS;i++)
			printf("%s\n",ret[i]);
	printf("\n\n\n");

	printf("Output of copy3 --> Z\n");
	for(i=0;i<MONTHS;i++)
			printf("%s\n",Z[i]);
	printf("\n\n\n");

	return 0;
}
开发者ID:f2008700,项目名称:BITS,代码行数:32,代码来源:17months.c

示例4: TEST

TEST(ustl_forward_list, constructors) {
  // default:
  ustl::forward_list<int> l1;
  l1.insert_after(l1.before_begin(), 3);
  ASSERT_EQ(3, l1.front());

  // fill:
  ustl::forward_list<int> fill1(ustl::forward_list<int>::size_type(10));
  auto it1 = fill1.begin();
  for (size_t i = 0; i < 10; i++)
    ASSERT_EQ(*it1++, 0);

  ustl::forward_list<int> fill2(ustl::forward_list<int>::size_type(10),
                                static_cast<int>(-1));
  auto it2 = fill2.begin();
  for (size_t i = 0; i < 10; i++)
    ASSERT_EQ(*it2++, -1);

  // range:
  ustl::vector<int> v1{1, 2, 3};
  ustl::forward_list<int> range1(v1.begin(), v1.end());
  const ustl::forward_list<int> range1a{1, 2, 3};
  ASSERT_TRUE(range1 == range1a);

  // copy:
  ustl::forward_list<int> copy1(range1);
  ASSERT_TRUE(copy1 == range1a);

  // initializer list:
  ustl::forward_list<int> l2{1, 2, 3, 4, 5};
  const ustl::forward_list<int> l3{1, 2, 3, 4, 5};
  ASSERT_TRUE(l2 == l3);
}
开发者ID:ChrisCummins,项目名称:phd,代码行数:33,代码来源:forward_list.cpp

示例5: mv1

/*
 * Move
 */
void mv1( struct ext2_filesystem *fs, char *pathS,
         char *nameS, char *pathD, char *nameD ) {

    copy1( fs, pathS, nameS, pathD, nameD );
    rm1( fs, pathS, nameS );

}
开发者ID:justinvreeland,项目名称:xinu-arm,代码行数:10,代码来源:ext2.c

示例6: copy1

void Docking::NachoptimierungR(Protein* p,int score,Vector3 shift_back, System s1){

	Protein copy1(*p, true);
	Protein* copy = &copy1;
	
	TranslationProcessor translation;
	Vector3 toOrigin = shift_back*(-1);
	translation.setTranslation(toOrigin);
	
	copy->apply(translation);
		
	srand(time(NULL));
	
	Matrix4x4 randomMatrix;
	
	//nachoptimierung nur minimal da score schon gut
	
	float angle = 1 + rand() %  (10 - 1 + 1);
	
	Angle randomAngle(angle, false);
	
	//Random Vektor als rotationsaxe
	int min = -3;
	int max = 3;
	
	float x = min + rand() % (max - min +1);
	float y = min + rand() % (max - min +1);
	float z = min + rand() % (max - min +1);
	
	Vector3 vec(x,y,z);
	
	randomMatrix.setRotation(randomAngle,vec);
	
	TransformationProcessor randomTransformation(randomMatrix);
	copy->apply(randomTransformation);
	
	TranslationProcessor translation2;
	translation2.setTranslation(shift_back);
	
	copy->apply(translation2);
	
	vector<Vector3> position  = data.savePositions(copy);

	float newscore = scoring(position);
	
	//nur wenn der score höher ist interessierr er uns
	if(newscore > score){

		System opt;
		opt.insert(*copy);
		data.writeFinalComplex(s1, opt, score, newscore);

	}

}
开发者ID:HeyJJ,项目名称:DockingProject,代码行数:55,代码来源:Docking.C

示例7: copy1

	void copy1(FPNode<T> * from, FPNode<T> * to)
	{
		for (auto x : from->offspring)
		{
			FPNode<T> *new_node = new FPNode<T>(x.first, to);
			to->offspring[x.first] = new_node;
			new_node->count = x.second->count;
			pointers[x.first].first.push_back(new_node);
			copy1(x.second, new_node);
		}
	}
开发者ID:generall,项目名称:text_patterns,代码行数:11,代码来源:FPTree.hpp

示例8: main

main() {
    char string1[10], string3[10];
    char  *string2 = "Hello", string4[10]="Good Bye";
    
    copy1(string1,string2);
    printf("String1 : %s\n",string1);
    
    copy2(string3,string4);
    printf("String3 : %s\n",string3);
    
    *string3 = 'Z';
    printf("String3 : %s\n",string3);
}
开发者ID:ITCS3146-OS,项目名称:cstudy,代码行数:13,代码来源:copyStringPointer.c

示例9: upheap

static int upheap(CHEAP *heap, int k)
{
    GB_VARIANT_VALUE x;
    int r = 0;

    copy1(heap, k, &x);
    while (k && compare1(heap, &x, parent(k)) < 0) {
        copy(heap, parent(k), k);
        k = parent(k);
        r++;
    }
    copy2(heap, &x, k);
    return r;
}
开发者ID:ramonelalto,项目名称:gambas,代码行数:14,代码来源:c_heap.c

示例10: main

int main ( void )
{
	char string1[ 10 ]; /* create array string1 */
	char *string2 = "Hello"; /* create a pointer to a string */
	char string3[ 10 ]; /* create array string3 */
	char string4[] = "Good Bye"; /* create a pointer to a string */

	copy1( string1, string2 );
	printf( "string1 = %s\n", string1 );

	copy2( string3, string4 );
	printf ("string3 = %s\n", string3 );
	return 0; /*indicate successful termination */
} /* end main */
开发者ID:zedwarth,项目名称:C-Programming,代码行数:14,代码来源:fig07_21.c

示例11: copyprop

/*
 * The idea is to remove redundant copies.
 *	v1->v2	F=0
 *	(use v2	s/v2/v1/)*
 *	set v1	F=1
 *	use v2	return fail
 *	-----------------
 *	v1->v2	F=0
 *	(use v2	s/v2/v1/)*
 *	set v1	F=1
 *	set v2	return success
 */
static int
copyprop(Graph *g, Flow *r0)
{
	Prog *p;
	Adr *v1, *v2;

	USED(g);
	p = r0->prog;
	v1 = &p->from;
	v2 = &p->to;
	if(copyas(v1, v2))
		return 1;
	gactive++;
	return copy1(v1, v2, r0->s1, 0);
}
开发者ID:IsCoolEntertainment,项目名称:debpkg_golang,代码行数:27,代码来源:peep.c

示例12: main

int main () {
	char s1 [16];                        //char-string array
	char *s2 = "Now is the time";		//pointer
	char s3[25];
	char s4[] = " for all good programmers";

	copy1(s1, s2);

	printf("s1:  %s\n", s1);

	copy2(s3, s4);

	printf("s3:  %s\n", s3);

	return 0;
}
开发者ID:GabrielSorensen,项目名称:CSIS3150,代码行数:16,代码来源:copy.c

示例13: copyprop

/*
 * The idea is to remove redundant copies.
 *	v1->v2	F=0
 *	(use v2	s/v2/v1/)*
 *	set v1	F=1
 *	use v2	return fail
 *	-----------------
 *	v1->v2	F=0
 *	(use v2	s/v2/v1/)*
 *	set v1	F=1
 *	set v2	return success
 */
int
copyprop(Reg *r0)
{
	Prog *p;
	Adr *v1, *v2;
	Reg *r;

	p = r0->prog;
	v1 = &p->from;
	v2 = &p->to;
	if(copyas(v1, v2))
		return 1;
	for(r=firstr; r!=R; r=r->link)
		r->active = 0;
	return copy1(v1, v2, r0->s1, 0);
}
开发者ID:99years,项目名称:plan9,代码行数:28,代码来源:peep.c

示例14: main

int main(void) {

	char string1[10];
	char *string2 = "Hello";
	char string3[10];
	char *string4 = "Good bye";

	copy1(string1, string2);
	printf("string1 = %s\n", string1);

	copy2(string3, string4);
	printf("string3 = %s\n", string3);

	system("pause");
	return 0;
}
开发者ID:syvjohan,项目名称:CFun,代码行数:16,代码来源:main.c

示例15: run_assign_and_copy_constructor_test

void
run_assign_and_copy_constructor_test(const char *test_name) {
    REMARK("Testing assignment and copy construction for %s\n", test_name);

    // test initializer with exemplar
    T initializer0;
    test_helper<T>::init(initializer0);
    T initializer7;
    test_helper<T>::set(initializer7,7);
    tbb::enumerable_thread_specific<T> create1(initializer7);
    (void) create1.local();  // create an initialized value
    ASSERT(7 == test_helper<T>::get(create1.local()), NULL);

    // test copy construction with exemplar initializer
    create1.clear();
    tbb::enumerable_thread_specific<T> copy1(create1);
    (void) copy1.local();
    ASSERT(7 == test_helper<T>::get(copy1.local()), NULL);

    // test copy assignment with exemplar initializer
    create1.clear();
    tbb::enumerable_thread_specific<T> assign1(initializer0);
    assign1 = create1;
    (void) assign1.local();
    ASSERT(7 == test_helper<T>::get(assign1.local()), NULL);

    // test creation with finit function
    FunctorFinit<T,7> my_finit7(SecretTag);
    tbb::enumerable_thread_specific<T> create2(my_finit7);
    (void) create2.local();
    ASSERT(7 == test_helper<T>::get(create2.local()), NULL);

    // test copy construction with function initializer
    create2.clear();
    tbb::enumerable_thread_specific<T> copy2(create2);
    (void) copy2.local();
    ASSERT(7 == test_helper<T>::get(copy2.local()), NULL);

    // test copy assignment with function initializer
    create2.clear();
    FunctorFinit<T,0> my_finit(SecretTag);
    tbb::enumerable_thread_specific<T> assign2(my_finit);
    assign2 = create2;
    (void) assign2.local();
    ASSERT(7 == test_helper<T>::get(assign2.local()), NULL);
}
开发者ID:glycerine,项目名称:shore-mt,代码行数:46,代码来源:test_enumerable_thread_specific.cpp


注:本文中的copy1函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。